Write a Java program to convert Fahrenheit to Celsius

By | February 7, 2017

Java program to convert Fahrenheit to Celsius


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

 

SOURCE CODE ::

 

import java.util.Scanner;
 
public 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.nextInt();
 
    temperatue = ((temperatue - 32)*5)/9;
 
    System.out.println("Temperatue in Celsius = " + temperatue);
  }
}

 

OUTPUT ::

 

Enter temperatue in Fahrenheit
87
Temperatue in Celsius = 30.555555

 

Leave a Reply