C 程序:将摄氏温度转换成华氏温度
原文:https://www.studytonight.com/c/programs/important-concepts/celsius-to-fahrenheit
下面是一个从摄氏到华氏的温度转换程序。我们所要做的就是使用程序中的简单公式,即如果温度值以摄氏度为单位,将其乘以1.8
或9/5
,并将32
加到结果中,这将给出等效的法赫内热值。
#include<stdio.h>
int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
float celsius, fahrenheit;
printf("\n\nEnter temperature in Celsius: ");
scanf("%f", &celsius);
fahrenheit = (1.8*celsius) + 32;
printf("\n\n\nTemperature in Fahrenheit is: %f ", fahrenheit);
printf("\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}
输出:
将摄氏温度转换成华氏温度的程序
要将华氏温度转换为摄氏温度,公式是,从数值中减去32
,然后乘以0.5556
或5/9
所以你所要做的就是替换 avove 程序中的转换公式。去吧,你自己试试。