Home  • Programming • Java

Java program example to convert Fahrenheit to Celsius

Java program to convert Fahrenheit to Celsius: This code does temperature conversion from Fahrenheit scale to Celsius scale. For Celsius to Fahrenheit conversion use T = 9*T/5 + 32 where T is temperature on Celsius scale. Code
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.nextInt();
 
    temperatue = (temperatue - 32)*5/9;
 
    System.out.println("Temperatue in Celsius = " + temperatue);
  }
}
Compile and Run:

Comments 0


Copyright © 2024. Powered by Intellect Software Ltd