Open In App

Java Program to Convert Fahrenheit into Celsius

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will discuss how to convert a temperature value from Fahrenheit to Celsius using Java.

Note: Fahrenheit and Celsius are units of temperature measurement, denoted by °F and °C, respectively.

Formula

Celsius = (Fahrenheit - 32) / 1.8

Approach

  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.

Example: Here, the below Java Program demonstrates the conversion of a temperature value from Fahrenheit to Celsius

Java
// Java Program to Convert Fahrenheit into Celsius

class Geeks {

    public static void main(String[] args)
    {
        // temperature in fahrenheit
        double f = 50.0, c = 0.0;

        // calculate celsius temperature
        c = (f - 32) / 1.8;

        // print the celsius temperature
        System.out.println(
            "value of temperature in celsius:" + c);
    }
}

Output
value of temperature in celsius:10.0

Note: If you want to convert Celsius into Fahrenheit, you can refer to this article.


Similar Reads