Exercise 1-4

作者在 2009-02-13 08:52:26 发布以下内容
/* Write a program to print the corresponding Celsius to Fahrenhei table */
 
#include <stdio.h>
int main(void)
{
    float cels, fahr;
    int lower, upper, step;
   
    lower = 0;
    upper = 100;
    step  = 10;
   
    cels = lower;
    while ( cels <= upper)
    {
          fahr = 9 * cels / 5 + 32;
          printf("%.0f\t%.0f\n",cels, fahr);
          cels+=step;
    }
   
    getch();
    return 0;
}
文章评论,共0条
游客请输入验证码
浏览27702次
文章归档