1. 程式人生 > >13.任意次方後的後三位

13.任意次方後的後三位

stdio.h include for blog ret pad %d sca scanf

#include <stdio.h>

int main(int argc, char *argv[])
{
    int x,y,a = 1; 
    printf("input x y(x^y):");
    scanf("%d %d",&x,&y);
    int i;
    for(i = 1;i<=y;i++)
    {
        a=a*x; 
    }
    printf("%d\n",a);

    int x1,x2,x3;
    x1 = a-(a/10)*10;
    x2 = (a-(a/100)*100)/10;
    x3 
= (a-(a/1000)*1000)/100; printf("result:%d %d %d\n",x3,x2,x1); return 0; }

13.任意次方後的後三位