#include<stdio.h>
int main()
{
int c;
float f;
printf("请输入摄氏温度 ");
scanf("%d",&c);
f=9*c/5+32;
printf("%d",&f);
return 0;
}
f=9*c/5+32;改成f=9.0*c/5+32;
printf("%d",&f);改成printf("%d",(int)f);
代码修改如下:
#include<stdio.h>
int main()
{
int c;
float f;
printf("请输入摄氏温度 ");
scanf("%d",&c);
f=9.0*c/5+32;
printf("%d",(int)f);
return 0;
}
你题目的解答代码如下:
#include<stdio.h>
int main()
{
int c;
float f;
printf("请输入摄氏温度 ");
scanf("%d",&c);
f=9*c/5.0+32; //除数要用5.0小数
printf("%f",f); //f是浮点数要用"%f"输出
return 0;
}
如有帮助,望采纳!谢谢!