fork download
  1. #include <stdio.h>
  2.  
  3. // 华氏温度转摄氏温度
  4. double fahrenheit_to_celsius(double F) {
  5. double C = (F - 32) * 5.0 / 9.0;
  6. return C;
  7. }
  8.  
  9. int main() {
  10. double f, c;
  11. printf("请输入华氏温度:");
  12. scanf("%lf", &f);
  13.  
  14. c = fahrenheit_to_celsius(f);
  15. printf("对应的摄氏温度为:%.2f\n", c);
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5320KB
stdin
286
stdout
请输入华氏温度:对应的摄氏温度为:141.11