/*convert Fahrenheit to Celsius*/
import java.util.*;
class FahrenheitToCelsius
{
public static void main(String[] args)
{
float temperatue;
Scanner in = new Scanner(System.in);
System.out.println("Enter temperatue in Fahrenheit:");
temperatue = in.nextFloat();
temperatue = ((temperatue - 32)*5)/9;
System.out.println("Temperatue in Celsius = " + temperatue);
}
}
import java.util.*;
class FahrenheitToCelsius
{
public static void main(String[] args)
{
float temperatue;
Scanner in = new Scanner(System.in);
System.out.println("Enter temperatue in Fahrenheit:");
temperatue = in.nextFloat();
temperatue = ((temperatue - 32)*5)/9;
System.out.println("Temperatue in Celsius = " + temperatue);
}
}
● Save the file as FahrenheitToCelsius.java.
● When the program is run, the following output is displayed:
>java FahrenheitToCelsius
Enter temperatue in Fahrenheit:
12.5
Temperatue in Celsius = -10.833333
Enter temperatue in Fahrenheit:
12.5
Temperatue in Celsius = -10.833333