码迷,mamicode.com
首页 > 其他好文 > 详细

练习2-4 温度转换 (5 分)

时间:2019-06-30 19:10:25      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:span   整型   pre   turn   user   html   5*   etc   text   

练习2-4 温度转换 (5 分)

本题要求编写程序,计算华氏温度150°F对应的摄氏温度。计算公式:C=5*(F-32)/9,式中:C表示摄氏温度,F表示华氏温度,输出数据要求为整型。

输入格式:

本题目没有输入。

输出格式:

按照下列格式输出

fahr = 150, celsius = 计算所得摄氏温度的整数值


 

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {

int C,F=150;
C=5*(F-32)/9;
printf("fahr = 150, celsius =%d",C);


return 0;
}

 

 

 



练习2-4 温度转换 (5 分)

标签:span   整型   pre   turn   user   html   5*   etc   text   

原文地址:https://www.cnblogs.com/xxl-h/p/11110701.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!