13. JAVA Program to convert Fahrenheit Into Celsius.
How does this program work?
- In this programme you will learn how to easily convert Temperature of city in fahrenheit into celsius.
- input of user is stored in variables and then by using the formula below we can easily convert fahrenheit into celsius.
- This programme perform mathematical calculation and display the result using java.
Here is the code
// Convert Temperature in Fahrenheit into celsius
import java.util.Scanner;public class temp
{
public static void main(String args[])
{
float f,a,c;
System.out.println("Enter the temperature in farenheit:\n");
Scanner obj1=new Scanner(System.in);
f=obj1.nextFloat();
a=f-32;
c=a*5/9;
System.out.println("Temperature converting to celcius is:"+c);
}
}