Skip to content
Related Articles

Related Articles

Improve Article

Java Program to Convert Fahrenheit into Celsius

  • Last Updated : 24 Nov, 2020

Here we are converting Fahrenheit temperature value to Celsius temperature value. Fahrenheit and Celsius are the measures of temperature having Unit in degrees as oF and oC respectively.


Celsius = (Fahrenheit - 32) / 1.8


  1. Initialize the  value of Fahrenheit as 50.0 and Celsius as 0.0
  2. Calculate the Celsius using the above given formula.
  3. Display Celsius temperature.



// Java Program to Convert Fahrenheit into Celsius
class fahrenheittocelsius {
    public static void main(String[] args)
        // temperature in fahrenheit
        double fahrenheit = 50.0, celsius = 0.0;
        // calculate celsius temperature
        celsius = (fahrenheit - 32) / 1.8;
        // print the celsius temperature
            "value of temperature in celsius:" + celsius);
value of temperature in celsius:10.0

Time Complexity: O(1)

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :