fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. double deg =30, rad;
  13. rad = Math.toRadians(deg);
  14.  
  15. double s =Math.sin(rad);
  16. double c =Math.cos(rad);
  17. double t =Math.tan(rad);
  18.  
  19. System.out.println( "角度" +deg + "度");
  20. System.out.println("sin "+(float)s);
  21. System.out.println("cos "+(float)c);
  22. System.out.println("tan "+(float)t);
  23. }
  24. }
  25.  
Success #stdin #stdout 0.15s 50812KB
stdin
Standard input is empty
stdout
角度30.0度
sin 0.5
cos 0.8660254
tan 0.57735026