int main(int argc, char *argv[]) { int i; for (i = LOWER; i <= MAX ; i+=STEP) printf("%3d\t%6.1f\n",i, fahr_to_celsius(i)); return 0; }
int main(int argc, char const *argv[]) { printf("Fahr Celsius\n"); for (int i = 0; i <= 300; i = i + 20) { printf("%3d %6.1f\n", i, fahr_to_celsius(i)); } return 0; }
int main() { int lower, upper, step, i; lower = 0; upper = 300; step = 20; for(i = lower; i <= upper; i += step) { printf("%3d: %6.1f\n", i, fahr_to_celsius(i)); } return 0; }
int main(){ float celsius, fahr; int lower = 0; int upper = 300; int step = 20; printf("Fahrenheit Celsius\n"); fahr = lower; while (fahr <= upper) { printf("%10.0f %6.1f \n", fahr, fahr_to_celsius(fahr)); fahr = fahr + step; } }
/* print Fahrenheit-Celsius table for fahr = 0, 20, ..., 300 */ main() { float fahr; int lower, upper, step; lower = 0; /* lower limit of temperature table */ upper = 300; /* upper limit */ step = 20; /* step size */ fahr = lower; while (fahr <= upper) { printf("%3.0f %6.1f\n", fahr, fahr_to_celsius(fahr)); fahr = fahr + step; } }
int main() { int ret; #ifdef HELLO_WORLD ret = print_hellword(); #endif // HELLO_WORLD #ifdef FAHR_TO_CELSIUS ret = fahr_to_celsius(); #endif // FAHR_TO_CELSIUS #ifdef FILE_COPY ret = file_copy(); #endif // FILE_COPY #ifdef TEST_CHAR ret = test_char(); #endif // TEST_CHAR #ifdef CHAR_COUNTING ret = char_counting(); #endif // CHAR_COUNTING #ifdef LINE_COUNTING ret = line_counting(); #endif // LINE_COUNTING #ifdef FUNC_PL struct pl_ops *func_pl; func_pl = pl_setup(); func_pl->arrays(); #endif // FUNC_PL #ifdef FUNC_PL_TEST char s1[] = "hello world"; char *s2 = "hello world"; printf("s1 is %d\n", sizeof(s1)); printf("s2 is %d\n", sizeof(s2)); #endif // FUNC_PL_TEST ret = 0; if (ret > 0){ printf("\nprint successfully!, result is 0x%x.\n", ret); } }
main() { float fahr, celsius; float lower, upper, step; lower = 0; upper = 300; step = 10; fahr = lower; printf(" F C\n"); printf("==========\n"); while (fahr <= upper) { celsius = fahr_to_celsius(fahr); printf("%3.0f %6.1f\n", fahr, celsius); // first field 3 digits wide, second 6 digits fahr = fahr + step; } }
int main() { for (int fahr = LOWER; fahr <= UPPER; fahr += STEP) printf(" %3d %6.1f\n", fahr, fahr_to_celsius(fahr)); }