Various Mathematical Funtions

2 comments - Post a comment

/*The Given Program Calculates the Following Mathematical operations:
*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
*/

 
This Post has 2 Comments Add your own!
Anonymous - February 1, 2011 at 5:01 AM

What a great web log. I spend hours on the net reading blogs, about tons of various subjects. I have to first of all give praise to whoever created your theme and second of all to you for writing what i can only describe as an fabulous article. I honestly believe there is a skill to writing articles that only very few posses and honestly you got it. The combining of demonstrative and upper-class content is by all odds super rare with the astronomic amount of blogs on the cyberspace.

Anonymous - July 12, 2011 at 10:30 AM

In this program change the below line.

Correct statement:

public static void main(String args[])

Post a Comment