That saves your time while coding and makes the code easier to read.

Java automatically imports classes.

The syntax of Math.pow() is simple; it includes two arguments: the base and the exponent.

Article image

The base is the number youre rising to power; the exponent is the power to raise the number.

The BigInteger class belongs tojava.mathpackage.

In the case of for-loop operation, the power should be greater than 1.

Article image

But you’ve got the option to also usedouble, to allow floating-point numbers.

Here we declare a public class named Main.

The result would then be assigned back to theresult.

Article image

Like result = result*base.

Thats great when you know the exact number of loop rounds beforehand.

Article image