#include <stdio.h>
int main()
{
int change,price;
printf("请输入商品价格:");
scanf("%d",&price);
if(0 <= price <=100)
{
change = 100 - price;
printf("应找您%d元",change);
}
else
{
printf("输入错误");
}
return 0;
}
#include <stdio.h>
int main()
{
int change,price;
printf("请输入商品价格:");
scanf("%d",&price);
if(0 <= price <=100)
{
change = 100 - price;
printf("应找您%d元",change);
}
else
{
printf("输入错误");
}
return 0;
}
第9行改为:
if(price>=0 && price<=100)