2 条题解

  • 0
    @ 2023-10-24 15:59:00

    温度转换

    编一程序,将摄氏温度换为华氏温度。公式为:f(华氏温度)=9/5*c(摄氏温度)+32。

    输入 整数c

    输出 实数f(保留两位小数)

    #include <stdio.h>
    int main() {
        int c; scanf("%d", &c);
        float a, f;
        a = c * 0.01;  // 将整数c转化为浮点数a
        f = 9 * a * 100 / 5 + 32;
        printf("%0.2f", f);  // 保留两位小数
        return 0;
    }
    
    • 0
      @ 2023-10-22 15:29:54
      #include<stdio.h>
      #include<math.h>
      int main() {
      int c;
      scanf("%d",&c);
      double f=9.0/5.0*c+32;
      printf("%.2lf",f);
      return 0;
      }
      
      • 1

      信息

      ID
      15
      时间
      1000ms
      内存
      16MiB
      难度
      4
      标签
      递交数
      127
      已通过
      62
      上传者