+ 2

# cos(PI/2)=? Math everyone

what the output of this code? double a = Math. cos(Math. PI/2); double b = 0.0; if (a == b) System. out. println("True" ) ; else System.out.println("False") ; //answer False

5 Answers

+ 9

There are many questions which are not in lesson , but are in quizzes , U can always use google to learn more new things☺👍
(though most of specific & confusing quizzes are declined)

+ 3

InvBoy you probably missed the Math.cos part.
I agree that the question, though somewhat basic, is not really related to Java. Was it part of the tutorial here? If yes, then which lesson was it?

+ 3

Okay, I don't really think it's a great challenge question, but it does teach us about the issues with floating point precision. If you think it's not suitable for challenges, go ahead and report it! The Sololearn team can review and decide if they should remove the question.

+ 2

3.14... /2 is 0? Is a easy question

+ 2

double a = Math . cos(Math. PI/2);
a = 6.1234342....
but if we use integet type and casted it will be correct..
int a = (int) Math. cos(Math. PI/2) ; now a = 0

Hot today

Please help, any idea?

2 Votes

Loop question, I've tried everything that I knew I just don't know. Please help me solve it out

1 Votes

What is wrong? Error on test.

1 Votes

Help me solve this (using loop)

1 Votes

Help me wiht python

1 Votes

how can i flip any word with c++

0 Votes