提问,为什么写的程序输出只有6422040一个值
#include
int main()
{
float Inch ,Cetimeter;
Inch=0;
Cetimeter=0;
printf("请输入想要换算的厘米");
scanf("%d",&Inch);
Cetimeter=Inch*2.54;
printf("换算结果为%d英寸",&Cetimeter);
return 0;
}
输出那里去掉&符号
输出用%f
输出的是地址,另外%d不恰当
//注意一下数据类型以及输出输入格式化问题
//已经修改好了,具体看代码啊
#include<stdio.h>
int main()
{
float Inch, Cetimeter;
Inch = 0.0;
Cetimeter = 0.0;
printf("请输入想要换算的厘米");
scanf("%f", &Inch);
Cetimeter = Inch * 2.54;
printf("换算结果为%f英寸", Cetimeter);
return 0;
}