In this tutorial, we will write a C Program to convert Fahrenheit into Celsius. Let us start by understanding the formula for the conversion of Fahrenheit into Celsius.
Fahrenheit and Celsius, both are the unit for measuring the temperature. Fahrenheit is represented by oF and Celsius by oC.
Formula to convert Fahrenheit into Celsius
celsius = (fahrenheit – 32)*5/9
C ProgrC Program to Convert Temperature from Fahrenheit to Celsius
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<stdio.h> void main() { float c,f; //user input printf("Enter the Fahrenheit value: "); scanf("%f",&f); //conversion c = (f - 32) * 5 / 9; //Display the result printf("Celsius: %.3f", c); } |
Output:
Enter the Fahrenheit value: 64
Celsius: 17.778