Temperature of a city in Fahrenheit degree is input through the keyboard. Write a program to convert this temperature into Degree Celsius / Centigrade.
Related Read:
Basic Arithmetic Operations In C
Convert Degree Celsius To Fahrenheit: C Program
Formula to Convert Fahrenheit To Celsius.
From our previous video tutorial Convert Degree Celsius To Fahrenheit: C Program we already know the formula to convert temperature from Celsius to Fahrenheit. We will use the same formula and convert it to calculate Degree celsius from Fahrenheit.
Fahrenheit = (Centigrade * 1.8) + 32;
(Fahrenheit – 31) = (Centigrade * 1.8);
(Fahrenheit – 31) / 1.8 = (Centigrade);
So we’ll use this formula Centigrade = (Fahrenheit – 31) / 1.8; to calculate Degree Centigrade by getting Fahrenheit value from the user.
Convert Fahrenheit To Degree Celsius: C Program
Source Code: Convert Fahrenheit To Degree Celsius: C Program
- #include < stdio.h >
- int main()
- {
- float c, fh;
- printf("Enter temperature in Fahrenheit\n");
- scanf("%f", &fh);
- c = (fh - 32) / 1.8;
- printf("Temperature in Degree Celius is %f\n", c);
- return 0;
- }
Output 1:
Enter temperature in Fahrenheit
212
Temperature in Degree Celius is 100.000000
Output 2:
Enter temperature in Fahrenheit
113
Temperature in Degree Celius is 45.000000
For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert