#include <stdio.h>
int main()
{
float x,s;
printf(“输入要购买的公斤数:”);
scanf("%f",&x);
if(x>=0&&x<=5)
s=5x;
else if(x>5&&x<=10)
s=5x0.9;
else if(x>10&&x<=20)
s=5x0.8;
else if(x>20&&x<=50)
s=5x0.7;
else if(x>50&&x<=100)
s=5x0.6;
else
s=5x*0.5;
printf(“总金额为%f\n”,s);
}