Advertisement
Guest User

Untitled

a guest
May 20th, 2014
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.util.*;
  2. public class _5AngleUnitConverter {
  3.  
  4. public static void main(String[] args) {
  5. Scanner input = new Scanner(System.in);
  6. int n = input.nextInt();
  7.  
  8. for (int i = 0; i < n; i++) {
  9. double num = input.nextDouble();
  10. String numNext = input.next();
  11. if (numNext.equals("deg")) {
  12. double num1 = Math.toRadians(num);
  13. System.out.printf("%.6f", num1);
  14. System.out.println();
  15. }
  16. else if (numNext.equals("rad")) {
  17. double num2 = Math.toDegrees(num);
  18. System.out.printf("%.6f", num2);
  19. System.out.println();
  20. }
  21. }
  22. input.close();
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement