Hey guys,
Here's what I have to do:
Write a program that displays the table of Fahrenheit - Celsius temperatures.
The formula is : C = (5/9) (F-32)
C - Celsius, F- Fahrenheit
The range should be: 0 - 200, where as the step should be set to 20.
The output should be:
Fahrenheit Celsius
0 -17.8
20 -6.7
40 4.4
……
200…..
Define the floating point variables for the Celsius to be of type float and use the %f
format code.
Note that the sequence %.1f in printf indicates that the floating point should be
displayed with 1 character after decimal point. And %.4f - indicates a display of
floating-point with 4 characters after the decimal point.
Here's the code I have so far:
#include <stdio.h>
#include <simpio.h>
#include <genlib.h>
main()
{
float c, f;
for (f=0,f<200,f++20);
{
C = (5/9)*(F-32);
printf("%f %f",f,c);
}
getchar();
}
I'm not sure what I'm doing wrong, could someone give me some hints as to point me in the right direction? I'm still very noobish at C, so I apologise if their are obvious errors, because I don't see them...