Exercise 1-3

作者在 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;
}
文章评论,共0条
游客请输入验证码
浏览27785次
文章归档