1304 - C语言程序设计教程(第三版)课后习题4.9
输入一个华氏温度,要求输出摄氏温度。公式为 c=5(F-32)/9 输出要求有文字说明,取2位小数。
Input
一个华氏温度,浮点数
Output
摄氏温度,浮点两位小数
Examples
Input
-40
Output
c=-40.00
Hint
零下40度,可以不问是?氏
Solution C
#include<stdio.h> main() {float F,c; scanf("%f",&F); c=5*(F-32)/9; printf("c=%.2f",c); }
Solution C++
#include<stdio.h> main() { float a,c,F; scanf("%f",&a); F=a;c=5*(F-32)/9; printf("c=%.2f",c); }
Hint
零下40度,可以不问是?氏