1116 The last three digits after any power (1)

Title description

Program to find the last three digits of an integer at any power, that is, find the last three digits of x^y.

Input requirements

Enter integers x and y.

Output requirements

Output the value of x^y and the last 3 digits of the number.

Input sample

6 6

Sample output

46656 656

Reference program

#include<stdio.h>
#include<math.h>

int main()
{
    int x,y,result,result_3;

    scanf("%d%d",&x,&y);
    result=pow(x,y);
    result_3=result%1000;
    printf("%d %d\n",result,result_3);
    return 0;
}

 

Guess you like

Origin blog.csdn.net/weixin_44643510/article/details/113970692