how to get power of a number using import java.lang.math code example
Example 1: how to find power of a number in java
int powerOfNumber = (int) Math.pow(number, power);
Example 2: Java program to find the power of a number
@Test
public void powerOfTheNumberProgram13() {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter any NUMBER: ");
int number = scanner.nextInt();
System.out.println("Enter the POWER: ");
int power = scanner.nextInt();
scanner.close();
int powerOfNumber = (int) Math.pow(number, power);
System.out.println("Power of a " + number + "^" + power + ": " + powerOfNumber);
}