Java Program Math Pow() Method to Calculate Power of Number

You are currently viewing Java Program Math Pow() Method to Calculate Power of Number

In this article, We are going to talk about the “Java Program Math Pow() Method to Calculate Power of Number”. Let’s try to do this article below.

Java Program Math Pow() Method to Calculate Power of Number

app.java

// Java program to demonstrate working
// of java.lang.Math.pow() method

import java.lang.Math;

class Gfg {

    // driver code
    public static void main(String args[])
    {
        double a = 30;
        double b = 2;
        System.out.println(Math.pow(a, b));

        a = 3;
        b = 4;
        System.out.println(Math.pow(a, b));

        a = 2;
        b = 6;
        System.out.println(Math.pow(a, b));
    }
}

Conclusion

I hope this article helps you to learn “Java Program Math Pow() Method to Calculate Power of Number”. If you face any issues please let me know via the comment section. Share this article with other Java program developers via social networks. Thank You!

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply