c - Expected expression error on a temperature conversion table -
getting "expected expression error" on line 17 when following c programming book. complete noob here , not sure i'm doing wrong.
int main() { float fahr, celsius; int lower, upper, step; lower = 0; /* lower limit of temperature table */ upper = 300; /* upper limit */ step = 20; /*step size */ fahr = lower; while (fahr <= upper ) { celsius = (5.0/9.0) * (fahr - 32.0); printf(“%3.0f %6.1f\n”, fahr, celsius); fahr = fahr + step; } return 0; }
you need replace quotes “”
in
printf(“%3.0f %6.1f\n”, fahr, celsius);
with standard double quotes ""
printf("%3.0f %6.1f\n", fahr, celsius);
as aside, should #include <stdio.h>
@ top of file declaration of printf
Comments
Post a Comment