+ 1
How to calculate x to the power y if x&y are input?
how to code this in java
3 Answers
0
int x; // from user
int y; // from user
while(y!=1){
x*=x;
y--;
}
system.out.println(x);
0
import java.lang.Math;
Math.pow(x, y);
how to code this in java