计算一个数的任意次方后的后三位数

计算一个数的任意次方后的后三位数

void three()
{
    
    
	int i,x,y,j,z = 1;
	printf("请输入一个数以及次方:");
	scanf("%d %d",&x,&y);
	for(i = 1;i <= y;i++)
	{
    
    
		z = z * x;
	}
	if(z >= 100)
	{
    
    
		j = z % 1000;
		printf("最后三位数是:%d\n",j);
	}
	else
	{
    
    
		printf("请重新输入!\n");
	}
}

猜你喜欢

转载自blog.csdn.net/weiwei_lol/article/details/109272578
今日推荐