用最简单的编程语言写一段程序,求3的100次方除以7的余数。

来源:百度知道 编辑:UC知道 时间:2024/05/30 00:00:54
快!

3^1%7=3
3^2%7=2
3^3%7=6
3^4%7=5
3^5%7=3
.......
......
所以知道3^100%7=3^4%7

编程
#include <math.h>
#include <stdio.h>
main()
{ int a;
a=pow(3,4)%7;
printf("%d",a);
}
如果你编程用3^100次方的话,计算机很可能死机,而且由于运算过程中的长度问题而死循环