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

Popular posts from this blog

PROGRAM OF CALCULATING INTERSECTION OF TWO ARRAYS

JAVA PROGRAM TO CREATE A DATABASE (SAMPLE PICTURE IS GIVEN)

Craze for Fashion