网站推广策略,网站推广服务包括哪些,医院风格 wordpress,贵阳网站外包【温度表达转化】 C语言代码C代码Java代码Python代码 #x1f490;The Begin#x1f490;点点关注#xff0c;收藏不迷路#x1f490; 利用公式 C5∗(F−32)/9 #xff08;其中C表示摄氏温度#xff0c;F表示华氏温度#xff09; 进行计算转化。
输出
输出一行#x… 【温度表达转化】 C语言代码C代码Java代码Python代码 The Begin点点关注收藏不迷路
利用公式 C5∗(F−32)/9 其中C表示摄氏温度F表示华氏温度 进行计算转化。
输出
输出一行包含一个实数表示对应的摄氏温度要求精确到小数点后5位。
样例输入
51样例输出
10.55556C语言代码
#include stdio.hint main() {double f; // 用于存储输入的华氏温度scanf(%lf, f); // 读取华氏温度值double c 5 * (f - 32) / 9; // 根据公式计算摄氏温度printf(%.5lf\n, c); // 输出摄氏温度精确到小数点后5位return 0;
}C代码
#include iostream
#include iomanipint main() {double f; // 用于存储输入的华氏温度std::cin f; // 读取华氏温度值double c 5 * (f - 32) / 9; // 根据公式计算摄氏温度std::cout std::fixed std::setprecision(5) c std::endl; // 输出摄氏温度精确到小数点后5位return 0;
}Java代码
import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner scanner new Scanner(System.in);double f scanner.nextDouble(); // 读取华氏温度值double c 5 * (f - 32) / 9; // 根据公式计算摄氏温度System.out.printf(%.5f\n, c); // 输出摄氏温度精确到小数点后5位}
}Python代码
f float(input()) // 读取华氏温度值c 5 * (f - 32) / 9 // 根据公式计算摄氏温度print(%.5f % c) // 输出摄氏温度精确到小数点后5位The End点点关注收藏不迷路