使用C程序将华氏温度转换为摄氏温度
我们实现的将华氏温度转换为摄氏温度的逻辑如下-
celsius = (fahrenheit - 32)*5/9;
算法
请参阅下面给出的将华氏温度转换为摄氏温度的算法。
Step 1: Declare two variables farh, cels
Step 2: Enter Fahrenheit value at run time
Step 3: Apply formula to convert
Cels=(farh-32)*5/9;
Step 4: Print cels示例
以下是将华氏温度转换为摄氏温度的C程序-
#include<stdio.h>
int main(){
float fahrenheit, celsius;
//得到斐波那契数列的极限
printf("Enter Fahrenheit: \n");
scanf("%f",&fahrenheit);
celsius = (fahrenheit - 32)*5/9;
printf("Celsius: %f \n", celsius);
return 0;
}输出结果执行以上程序后,将产生以下结果-
Enter Fahrenheit: 100 Celsius: 37.777779
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短