Q:

Example on Math class in java

0

Write a java program which do the following using the Math class :

1. Returns the trigonometric sine of an angle A in radians.

2. Returns the square root of a.

3. Returns a raised to the power of b.

4. Returns the natural logarithm of a

5. Round down to the nearest integer of a.

6. Round up to the nearest higher integer of a.

7. Generates a random double value greater than or equal to 0.0 and less than 1.0

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

public class Main
{
	public static void main(String[] args) {
	    
	    double A=50.4;
	    System.out.println(Math.toRadians(Math.sin(A)));
	    double a=9.3,b=3;
	    System.out.println(Math.sqrt(a));
	    System.out.println(Math.pow(a,b));
	    System.out.println(Math.log(a));
	    System.out.println(Math.floor(a));
	    System.out.println(Math.ceil(a));
	    System.out.println(Math.random());
	}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now