输出任意次方的后三位数
2016-11-29 18:16
197 查看
#include<stdio.h>
int main()
{
int x,y,i,p=1;
scanf("%d%d",&x,&y);
for(i=1;i<=y;i++)
{
p*=x;
}
p=p%1000;
if(p>99)
printf("%d\n",p);
else if(p>9)
printf("0%d\n",p);
else
printf("00%d\n",p);
return 0;
}
int main()
{
int x,y,i,p=1;
scanf("%d%d",&x,&y);
for(i=1;i<=y;i++)
{
p*=x;
}
p=p%1000;
if(p>99)
printf("%d\n",p);
else if(p>9)
printf("0%d\n",p);
else
printf("00%d\n",p);
return 0;
}
相关文章推荐
- 任意输入一个不超过八位数,反序输出,并打印出它是几位数。
- 任意输入不超过6位的整型数,求数的位数,用switch语句输出各个数,并逆序输出的相关做法。c语言。
- java第三周--(输出任意数之间的所有完数;3位数的任意整数,输出其降序数)
- 对一个5位数的任意整数,求出其降序数。例如,整数是82319,则其降序数是98321。算法提示:将整数的各位数分解到一维整型数组a中,再将a数组中的元素按降序排序,最后输出a数组元素值。
- PHP任意位数的大整数n统计n中各个数字出现的次数,并将结果以表格形式输出
- C++保留任意小数点后位数与格式化输出
- C++保留任意小数点后位数与格式化输出
- 用递归法将一个整数n转换成字符串,例如输入483,应输出字符串“483”。n的位数不确定,可以是任意位数的整数。
- 将任意一个三位数n逆序输出
- 输入一个任意位数的整数进行逆序输出
- 用递归法将一个整数n转换成字符串。例如,输入483,应输出字符串“483”。n的位数不确定,可以是任意位数的整数。
- 习题 7.17 用递归法将一个整数n转换成字符串。例如,输入483,应输出字符串“483”。n的位数不确定,可以是任意位数的整数。
- 求一个整数任意次方的后三位数
- 算法:输入任意一个4位数整数,将该数反序输出(例如:输入1354,输出4531)
- 【任意输入一串整数输出该数的位数】新手每天学写C程序(1)
- 任意输入一个三位数,判断该书是否是水仙花数。若是输出“yes”,否则输出“no”。
- 栈实现计算器四则运算+一个任意两个超大位数加法
- 面试宝典_Python.常规算法.0002.输出任意两个字符串中最长公共子串?
- C语言小数四舍五入输出可控制位数
- 输入两个整数n和m, 从数列1,2,...,n中任意选择几个数,使其和等于m, 要求编写程序输出所有的组合