I've just begun programming C, but I'm familiar with the syntax and such.
I've made a list where fahrenheit is compared to celsius, and it works fine when I use decimal integers. But when I use floating point then the output goes weird.
the code (with float):
the weird output of 1 line of the above:Code:#include <stdio.h> main () { int fahr, celsius; int lower, upper, step; lower = 0; upper = 300; step = 20; fahr = lower; while (fahr <= upper) { celsius = (5.0/9.0) * (fahr-32.0); printf("%3.0f %6.1f\n", fahr, celsius); fahr = fahr + step; } }
plz helpCode:-1 8064894583287849000lotsof0000 finally ending with 00.0