Java Program to Convert Fahrenheit to Celsius

In this tutorial you will learn about the Java Program to Convert Fahrenheit to Celsius and its application with practical example.

In this tutorial, we will learn to create a Java program that will Convert Fahrenheit to Celsius    using Java programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following c programming topics:

  • Java Operators.
  • Basic Input and Output
  • Class and Object.
  • Basic Java programming.
  • Looping statements.

What Is Temperature ?

Temperature is a quantity that is use to measure the freezing and the boiling point of water. Which is measured by different scales in different regions like Celsius and Fahrenheit.
In Celsius scale, the boiling point of water is 100°C, and the freezing point is at 0°C, while in the Fahrenheit scale the boiling point of water is 212°F and freezing point is at 32°F.

Java Program to Convert Fahrenheit to Celsius

In this program we will convert temperature from Fahrenheit to Celsius. We would first declared and initialized the required variables. Next, we would prompt user to input the value in Fahrenheit. Later we will Convert the values into Celsius.

To convert values from Fahrenheit to Celsius we will use following Formula:

C = (F – 32)*(5/9)where, F is temperature in Fahrenheit and C is temperature in Celsius.

Output

Java Program to Convert Fahrenheit to Celsius

Concept to find Fahrenheit to Centigrade.

First of all we will take the value in Fahrenheit temperature.
Then we will calculate c = 5 * (f – 32) / 9.
Print Celsius C.

In the above program, we have first declared and initialized a set variables required in the program.

  • f = it will hold Fahrenheit value.
  • c= it will hold Celsius value.

And  in the next statement user will be prompted to enter value in Fahrenheit and  which will be assigned to variable ‘f’.

After that with the formula we will convert the value of Fahrenheit to Celsius.

As you can see in above program, we first take value in Fahrenheit  as input from user. Then convert the value of Fahrenheit in to Celsius using above conversion equation and print the Temperature in Celsius.

In this tutorial we have learn about the Java Program to Convert Fahrenheit to Celsius and its application with practical example. I hope you will like this tutorial.