+ 1

How to calculate x to the power y if x&y are input?

how to code this in java

30th Sep 2018, 10:51 AM
Rishabh Rawat
Rishabh Rawat - avatar
3 Answers
0
int x; // from user int y; // from user while(y!=1){ x*=x; y--; } system.out.println(x);
30th Sep 2018, 11:21 AM
estifanos
estifanos - avatar
0
import java.lang.Math; Math.pow(x, y);
30th Sep 2018, 11:35 AM
Ulisses Cruz
Ulisses Cruz - avatar