作者在 2009-02-13 08:38:30 发布以下内容
/* Modify the temperature conversion program to print a heading above the table */
#include <stdio.h>
int main(void)
{
float fahr, cels;
int lower, upper, step;
lower = 0 ;
upper = 300;
step = 20;
fahr = lower;
printf("F\tC\n");
while (fahr <= upper)
{
cels = (5.0/9.0) * (fahr - 32);
printf("%3.0f\t%5.1f\n",fahr, cels);
fahr+=step;
}
getch();
return 0;
}
{
float fahr, cels;
int lower, upper, step;
lower = 0 ;
upper = 300;
step = 20;
fahr = lower;
printf("F\tC\n");
while (fahr <= upper)
{
cels = (5.0/9.0) * (fahr - 32);
printf("%3.0f\t%5.1f\n",fahr, cels);
fahr+=step;
}
getch();
return 0;
}