Menu
Topics Index
...
`

Trigonometric functions


If you need explanation Read this topic

If you need Answer Take test on this topic

Trigonometric functions
What will be the output of the following program?
public class FindValues {
    public static void main(String[] args) {
        double input = Math.toRadians(90);
        System.out.print(Math.sin(input));
        System.out.println(" " + Math.round(Math.cos(input)));
    }
}

A. 0 1.0
B. 1.0 0
C. Some other output 
D. Compilation Error
E. Runtime Error
Topic: Java Math Class - java.lang.Math

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

ans is b.90 is converted to radian(pi/2) and sin(pi/2)=1;cos(pi/2)=0;

Posted by Chintu Raparthi    2014-03-27 12:53:46


Ans is B sinn 90 is 1 it prints 1.0 and cos 90 is 0 it prints 0

Posted by Naga Sinst    2014-03-27 12:55:41


ans is B

Posted by Adithya Aleti    2014-03-27 12:58:06


B.is the answer.because.first SOP gives 1.0 then next SOP for cos gives round to 0.so B is answer.

Posted by Asad Ahmed    2014-03-27 13:10:17


Congratulations Chintu Sravan. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-03-28 04:27:12


© meritcampus 2019

All Rights Reserved.

Open In App