C program to convert fahrenheit to celsius

Category: C Program

Write a C program to convert fahrenheit to celsius. C program to enter the temperature in fahrenheit and convert it into celcius using operators.

Formula to convert temperature from fahrenheit to celcius

CELCIUS = ((FAHRENHEIT-32)*5)/9

And we can use operators to implement the same formula in our C program.

Example -

Input: Enter temperature in Celsius: 50
Output: 50.00 Fahrenheit = 10.00 Celsius

C program to convert fahrenheit to celcius

#include <stdio.h>

void main()
{
    float celsius, fahrenheit;
    printf("Enter temperature in Celsius: ");
    scanf("%f", &fahrenheit);
    celsius = ((fahrenheit-32)*5)/9;
    printf("%.2f Fahrenheit = %.2f Celsius", fahrenheit, celsius);
}

Output

Enter temperature in Celsius: 50
50.00 Fahrenheit = 10.00 Celsius

Recommended Posts