codescracker


java

Java Program to Convert Fahrenheit to Centigrade



« Previous Program Next Program »


Convert Fahrenheit to Centigrade

To convert Fahrenheit to centigrade in Java programming, you have to ask to the user to enter the temperature in Fahrenheit temperature to convert it into centigrade to display the equivalent temperature value in centigrade as shown in the following program.

Java Programming Code to Convert Fahrenheit to Centigrade

Following Java Program ask to the user to enter temperature in Fahrenheit to convert it into Centigrade/Celsius, then display the result on the screen:

/* Java Program Example - Convert Fahrenheit to Centigrade */
		
import java.util.Scanner;

public class JavaProgram
{
    public static void main(String args[])
    {
        float fah;
        double cel;
        Scanner scan = new Scanner(System.in);
		
        System.out.print("Enter Temperature in Fahrenheit : ");
        fah = scan.nextFloat();
		
        cel = (fah-32) / 1.8;
		
        System.out.print("Equivalent Temperature in Celsius = " + cel);
    }
}

When the above Java Program is compile and executed, it will produce the following output:

Java Program convert Fahrenheit to centigrade

Same Program in Other Languages

You may also like to learn and practice the same program in other popular programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test