9:20 pm - Thursday April 24, 2014

Java program for to find power using Math formula


/**

*@author :CandidJava.com

*@descriptions : This program  using  to find power using Math formula which is in <a href="http://www.exampledepot.com/egs/java.math/pkg.html">java.math</a> package

*/

class Power {

public static void main(String args[]) {

//declare two variables in double

double x1,x2;

//using Math.pow() find the power of given number

x1=Math.pow(5,6);

x2= Math.pow(4,2);

//Print the values of x1 and x2

System.out.println("The  value is "+x1);

System.out.println("the value is"+x2);

System.out.println(x1-x2);

}

}

output:

D:\ Candidjava\Code >javac Power.java

D:\ Candidjava\Code >java Power

TheĀ  value is 15625.0

The value is16.0

15609.0

Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply

Social Widgets powered by AB-WebLog.com.