#include<stdio.h> #include<math.h> #include<string.h> #include <stdlib.h> int main(int argc, char** argv) { /* 输入一个华氏温度F,要求输出相应的摄氏温度C。 公式为:C = 5/9(F-32) */ int f; float c; while( scanf("%d" , &f ) !=EOF ){ c = 5/9.0*(f - 32); printf("%.2f\n" , c); } return 0 ; } |
Double click to view unformatted code.