Advertisement

C语言题

阅读量:

复习过程中涉及的部分习题:

1、运用公式 ℃=(5/9)(℉-32)生成以下华氏温度与摄氏温度的对照表格:
0 -17
20 -6
40 4
60 15
80 26
100 37
120 48
140 60
160 71
180 82
200 93
220 104
240 115
260 126
280 137
300 148

复制代码
      1 #include <stdio.h>
      2 
      3 #define STEP 20
      4 #define UPER 300
      5 #define LOWER 0
      6 
      7 int main()
      8 {
      9    int celsius;
     10    int fahrenheit = LOWER;
     11 
     12    while (fahrenheit <= UPER)
     13    {
     14        celsius = (5 * (fahrenheit - 32)) / 9;
     15        printf("F: %d, C: %d\n", fahrenheit, celsius);
     16    

全部评论 (0)

还没有任何评论哟~