Java Program to Convert Degree to Radian Using Library Method

You are currently viewing Java Program to Convert Degree to Radian Using Library Method

Java program to convert degree to radian using library method

// Java program to convert degree to radian 
// using library method

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner X = new Scanner(System.in);

    double degree = 0;

    System.out.print("Enter degree: ");
    degree = X.nextDouble();

    double rad = Math.toRadians(degree);

    System.out.print("Radian is: " + rad);
  }
}

Output

Enter degree: 30
Radian is: 0.5235987755982988

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply