fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. Scanner in = new Scanner(System.in);
  10. double r, rad, d, m, s, deg, min, sec;
  11. r = in.nextDouble();
  12. if (r<0) rad=-r;
  13. else rad=r;
  14. d = rad * 180 / Math.PI;
  15. m=(d-Math.floor(d))*60;
  16. s=(m-Math.floor(m))*60;
  17. double dd = Math.floor(d);
  18. deg= dd%360;
  19. if ( r < 0 ) deg=-deg;
  20. double mm = Math.floor(m);
  21. min=Math.abs(mm);
  22. double ss = Math.round(s);
  23. sec=Math.abs(ss);
  24. System.out.printf("Ответ: %.0f радиан = %.0f°%.0f'%.0f˝",r,deg,min,sec);
  25. }
  26. }
Success #stdin #stdout 0.17s 321344KB
stdin
3
stdout
Ответ: 3 радиан = 171°53'14˝