3.7 高次方数的尾数

发布时间 2023-05-21 21:20:03作者: 痛苦代码源
#include <stdio.h>
int main (){
int i, x,y, last=1;
/★变量last保存求得的×的y次方的部分积的后三位*/
printf("Input x and y:An") ;
scanf("%d Sd",&x, &y);
for(i-1;i<=y;i++)
/*×自乘的次数y*/
 last=last*x%1000;/*将last乘x后对1000取模,即求积的后三位*/printf ("The last three digits is:%dn",last);
}