使用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
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短