Mega Code Archive

 
Categories / Java / Development Class
 

Using the pow() function

strictfp class MainClass {   public static void main(String[] args) {     // Display the square root of 2 using sqrt()     System.out.print("sqrt(2.0) = ");     System.out.println(Math.sqrt(2.0));     // Calculate and display using pow()     System.out.print("pow(2.0, 0.5) = ");     System.out.println(Math.pow(2.0, 0.5));     System.out.println();   } }