Fahrenheit To Celsius Java Program

This program is to convert Fahrenheit to Celsius temperature based on user input value. Below is mathematical formula for conversion from Fahrenheit to Celsius temperature .

T = 9*T/5 + 32 where T is temperature on Celsius scale.

import java.util.Scanner;

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("Converted Temperatue in Celsius = " + temperatue);


Enter Temperatue in Fahrenheit
Converted Temperatue in Celsius = 37.77778

Enter Temperatue in Fahrenheit
Converted Temperatue in Celsius = 10.0

Enter Temperatue in Fahrenheit
Converted Temperatue in Celsius = 23.88889


For more Algorithms and Java Programing Test questions and sample code follow below links



About Saurabh Gupta

My Name is Saurabh Gupta, I have approx. 10 Year of experience in Information Technology World manly in Java/J2EE. During this time I have worked with multiple organization with different client, so many technology, frameworks etc.
This entry was posted in Algorithm, Data Structure, Java, Programming Test and tagged , . Bookmark the permalink.

One Response to Fahrenheit To Celsius Java Program

  1. Pingback: Frequently Asked Algorithms and Programs in Interviews | Facing Issues On IT

Comments are closed.