Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0154dfd

Browse files
authored
Create 天梯初级7-28 输出华氏-摄氏温度转换表
1 parent 473e248 commit 0154dfd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*该题涉及两个尚未熟悉的点。
2+
1:if条件判断中“逻辑与”的使用,2:占位格式化输出(代码第十行)*/
3+
#include <stdio.h>
4+
int main()
5+
{
6+
int lower;
7+
double upper;
8+
scanf("%d %lf",&lower,&upper);
9+
if (lower <= upper && upper <= 100){
10+
printf("fahr celsius\n");
11+
while (lower <= upper && upper <= 100){
12+
printf("%d%6.1f\n",lower,5*(lower-32)/9.0);
13+
lower += 2;
14+
}
15+
} else {
16+
printf("Invalid.");
17+
}
18+
return 0;
19+
}

0 commit comments

Comments
 (0)