使用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 恩师诗词祝福语简短大全