*1. Square root
*2. POwer of a number
*3. Sine Value
*4. Cosine Value
*5. Logarithm Value
*6. Absolute value
*
*
/* Simple Java Program For Various Mathematical Operation */
import java.lang.Math;
class MathFunctions
{
public static void main(System args[])
{
double x = 7;
double y;
System.out.println("Given Number "+x);
y = Math.sqrt(x);
System.out.println("Square Root : "+y);
y = Math.pow(x,3);
System.out.println("Power : "+y);
y = Math.sin(x);
System.out.println("Sine : "+y);
y = Math.cos(x);
System.out.println("Cosine : "+y);
y = Math.log(x);
System.out.println("Logrithm : "+y);
y = Math.abs(x);
System.out.println("Absolute Value : "+y);
}
}
Given Number 7.0
Square Root : 2.6457513110645907
Power : 343.0
Sine : 0.6569865987187891
Cosine : 0.7539022543433046
Logrithm : 1.9459101490553132
Absolute Value : 7.0
*/
0 comments:
Post a Comment