C program to convert temperature from degree Fahrenheit to Celsius
Write a C program to input temperature in degree Fahrenheit and convert it to degree Centigrade. How to convert temperature from degree Fahrenheit to degree Celsius in C programming. C program for temperature conversion.
Input temperature in Fahrenheit = 205
Output = 96.11 C
Required knowledge:
Fundamentals of C, Data types, Taking user input in C, Temperature conversion tableConversion formula
°C = (°F -32) * 5/9Program
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| /** * C program to convert temperature from degree Fahrenheit to Celsius */ #include <stdio.h>
void
main() { float celsius, fahrenheit; // Reads temperature in Fahrenheit from user printf ( "Enter temperature in Fahrenheit: " ); scanf ( "%f" , &fahrenheit); // Converts fahrenheit to celsius celsius = (fahrenheit-32) * 5/9; printf ( "\n%.2f Fahrenheit = %.2f Celsius" , fahrenheit, celsius); } |
Note: %.2f is used to print fractional values only up to two decimal places. You can also use %f to print fractional values normally up to six decimal places.
Output
Enter temperature in Fahrenheit: 205
205.00 Fahrenheit = 96.11 Celsius
205.00 Fahrenheit = 96.11 Celsius
Enjoy it....................
Comments
Post a Comment
Dears! Yours Comment approved in 24 hours also your answer in 24 hours.......