输出华氏-摄氏温度转换表

https://pintia.cn/problem-sets/13/problems/408

 1 #include <stdio.h>
 2 int main(void)
 3 {
 4     int lower, upper;
 5     int fahr;
 6     double celsius;
 7 
 8     scanf("%d %d", &lower, &upper);
 9     if (lower <= upper && upper <= 100)
10     {
11         printf("fahr celsius
");
12         for (fahr = lower; fahr <= upper; fahr += 2)
13         {
14             celsius = 5.0 * (fahr - 32) / 9;
15             printf("%d%6.1f
", fahr, celsius); //%6.1f,6是显示宽度,不足6位,在左边添加空格
16         }
17     }
18     else
19     {
20         printf("Invalid
");
21     }
22 
23     return 0;
24 }
原文地址:https://www.cnblogs.com/2018jason/p/12253712.html