Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class _5AngleUnitConverter {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int n = input.nextInt();
- for (int i = 0; i < n; i++) {
- double num = input.nextDouble();
- String numNext = input.next();
- if (numNext.equals("deg")) {
- double num1 = Math.toRadians(num);
- System.out.printf("%.6f", num1);
- System.out.println();
- }
- else if (numNext.equals("rad")) {
- double num2 = Math.toDegrees(num);
- System.out.printf("%.6f", num2);
- System.out.println();
- }
- }
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement