program to convert Fahrenheit to Celsius

/*Write a program to convert Fahrenheit to Celsius. The formula for the conversion is as follows: Celsius =( 5 / 9 ) * ( Fahrenheit – 32 )*/

class fifth
{
public static void main(String args[])

{
float Celsius;

int Fahrenheit=Integer.parseInt(args[0]);

Celsius = (float)((5f/9f)*(Fahrenheit-32));

System.out.println(Celsius);
}
}

0 comments:

Post a Comment