使用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 好听的元旦简短祝福语