viernes, 1 de julio de 2016

convert from degrees to radians using JAVA

The following program performs the conversion from degrees to radians using a static method

import java.util.Scanner;
public class Convert {
static double d, r;
static Scanner read=new Scanner(System.in);

static void deToRad(double d)
{
r=d*Math.PI/180.0;
System.out.println("Radians="+r);

}

public static void main(String args[])
{

System.out.println("Enter the value of the degrees");
double degrees=read.nextDouble();
deToRad(degrees);

}


}

Regards

No hay comentarios:

Publicar un comentario