Java Radians to Degrees

Java Radians to Degrees


Posted in : Java Posted on : October 13, 2011 at 3:47 PM Comments : [ 0 ]

In this section you will learn how to change the radians into degrees.

Java Radians to Degrees

In this section you will learn how to change the radians into degrees.

Here I am giving a simple example which is concern to change the radians value into degrees. In mathematics radian is used for measuring angle. It can be defined as the ratio of length and radius of a circular arc.

RadianToDegree.java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class RadianToDegree
{
public static final double PI= 3.141592653589793;
public int degree(double rad)
{
double deg = (rad*(180/PI));
int d = (int)deg;
return d;
}
public static void main (String arr[]) throws IOException
{
RadianToDegree dg = new RadianToDegree();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the value in radian");
double radian = Double.parseDouble(br.readLine());
System.out.println("degrees("+radian+") = "+dg.degree(radian));
}
}

Output :

When you will execute the above example you will get the output as :

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics