Celsius to Fahrenheit program wont work right.. (ANSI C)
#include <stdio.h>
int main (int argc, const char * argv[]) {
float fahr, celsius;
int lower, upper, step;
lower = -18;
upper = 149;
step = 18;
celsius = lower;
while (celsius <= upper) {
fahr = (9.0/5.0) * (celsius+32.0);
printf ("%d\t%d\n", celsius, fahr);
celsius = celsius + step;
}
return 0;
}
Log:
0 -1070465024
0 0
0 1077018624
0 1078067200
0 1078657024
0 1079115776
0 1079410688
0 1079705600
0 1080000512
0 1080164352
Message was edited by: Fios89
MacBook, Mac OS X (10.4.10)