POWER SOLVING IN JAVA
import java.util.Scanner;
public class xRaisePowery {
public static void main(String[] args){
Scanner scan = new Scanner(System.in) ;
System.out.println("ENTER THE BASE VALUE");
int x = scan.nextInt();
System.out.println("ENTER THE POWER");
int n = scan.nextInt();
int sum=1;
//now, we will apply condition for calculating the powers
for (int i =1 ; i<=n ; i++){
sum*=x;
}
System.out.println("THE SOLUTION IS :"+sum);
}
}
Comments
Post a Comment