Home / Programs / C Program to convert temperature from fahrenheit to celsius
Programming Example

C Program to convert temperature from fahrenheit to celsius

👁 2,385 Views
💻 Practical Program
📘 Step by Step Learning
Study this program carefully to understand the logic, output, and explanation in a structured way.

Program Code

 /**
 * C program to convert temperature from degree fahrenheit to celsius
 */

#include"stdio.h"

int main()
{
    float celsius, fahrenheit;

    // Reads temperature in fahrenheit
    printf("Enter temperature in Fahrenheit: ");
    scanf("%f", &fahrenheit);

    // Fahrenheit to celsius conversion formula
    celsius = (fahrenheit - 32) * 5 / 9;

    // Print the result
    printf("%.2f Fahrenheit = %.2f Celsius \n", fahrenheit, celsius);

    return 0;
}

Output

Enter temperature in Fahrenheit: -40
-40.00 Fahrenheit = -40.00 Celsius
Press any key to continue . . .

How to learn from this program

First read the algorithm, then study the program code line by line. After that, compare the code with the output and finally go through the explanation. This approach helps learners understand both the logic and the implementation properly.