急!!急!!c语言编程 输入一个摄氏温度,要求输出一个华氏温度。公式为f=5/9*c+32

来源:百度知道 编辑:UC知道 时间:2024/05/23 16:11:20
c语言编程 输入一个摄氏温度,要求输出一个华氏温度。公式为f=5/9*c+32
十万火急
谢谢

The C Programming Language书上有这题的吧

大体框架:
float f;
float c;
scanf("%f", &c);
f = 5.0/9*c + 32;
printf("%f\n", f);

#include "stdafx.h"

int main(int argc, char* argv[])
{
float tem1, tem2;
printf("请输入温度:\n");
scanf("%f", &tem1);
tem2 = tem1*5/9+32;
printf("华氏温度为:%f!", tem2);
printf("Hello World!\n");
return 0;
}

看看这个行不

#include <stdio.h>
main()
{
float f;
float c;
scanf("%f", &c);
f = 5.0/9*c + 32;
printf("%f\n", f);
}

#include<stdio.h>
void main()
{int f,c;
printf("请输入温度");
scanf("%d",c);
f=5/9*c+32;
printf("%d",f);
}

printf("F = %d\n", (int)(5 / 9.0f * c + 32));
}