The program presented converts the given temperature in Fahrenheit to Celsius using the following conversion formula:
F - 32
C = ----------------
1.8
#include "stdio.h"
#define F_LOW 0
#define F_MAX 250
#define STEP 25
main()
{
typedef float REAL;
REAL fahrenheit, celsius;
fahrenheit = F_LOW;
printf("Fahrenheit Celsius\n\n");
while( fahrenheit <= F_MAX )
{
celsius = ( fahrenheit - 32.0)/1.8;
printf("%5.1f %7.2f\n", fahrenheit, celsius);
fahrenheit = fahrenheit + STEP;
}
return 0;
}
Output:
Fahrenheit Celsius
0.0 -17.78
25.0 -3.89
50.0 10.00
75.0 23.89
100.0 37.78
125.0 51.67
150.0 65.56
175.0 79.44
200.0 93.33
225.0 107.22
250.0 121.11
Write a program to demonstrate Temperature Conversion Problem
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment