CALCULATING A NUMBER TO A POWER
// Calculating NUM to the EXPO power
// Creating a scanner, which lets us input numbers
Scanner calc = new Scanner(System.in);
// Defining variables without values (To be defined later)
double num, expo, sum;
System.out.println("Enter number: ");
// Giving the NUM variable value, the value will be the first Double we enter in the console. (The number that will be put to power.)
num = calc.nextDouble();
System.out.println("Enter exponent: ");
// Giving the EXPO variable value, the value will be the second Double we enter in the console. (The exponent.)
expo = calc.nextDouble();
// Giving the SUM variable value, which will calculate the number that we input into the console.
// Using the Math.pow() method to put the defined number to the defined power.
sum = Math.pow(num, expo);
//Printing the sum.
System.out.println(num + " To the power of " + expo + " = " + sum);