//高次幂的尾数

#include<iostream>
using namespace std;
int main()
{
int x,y;
int i=0;
char str[2];
cout<<"Input x and y(x**y):";
cin>>x>>str[1]>>str[2]>>y;
int last=1;
for(;i<y;i++)
{
last=last*x%1000;
}
cout<<"The last three digits of "<<x<<"**"<<y<<"is "<<last<<endl;
return 0;
}

posted @ 2012-03-26 22:05  加拿大小哥哥  阅读(299)  评论(0编辑  收藏  举报