help, how to write right | SoloLearn: Learn to code for FREE!

+1

help, how to write right

This code won't work: System.out.println(Math.sin(60), Math.sin(45); But why? How to write sin 45 and 60 using just one line?

12/21/2017 4:11:58 PM

Леонид Саханский

3 Answers

New Answer

+2

In Java, default angle unit is radians. So you have to use System.out.print(Math.sin(3.1416/3) + " " + Math.cos(3.1416/4)); Or something similar

+2

System.out.println(String.format("%s %s", Math.sin(Math.PI/3), Math.sin (Math.PI/4)));

+1

i need a answer how to write sin and cos on one line using Math.sin and Math.cos