public static void main(String args[]) {
int num = 2;
int pow = 5;
System.out.print(power(num , pow));
}
public static int power(int a , int b) {
int power = 1;
for (int c = 0; c < b; c++)
power *= a;
return power;
}
如何使用Java计算次方(次幂)
猜你喜欢
转载自my.oschina.net/u/3013327/blog/1563878
今日推荐
周排行