大家看看有没有什么问题?
main()
{
int p;
float n;
printf("please input a number:");
scanf("%f",&n);
if(n<0) printf("error!");
else
p=(int)n/100;
switch(p)
{
case 0: printf("%f",n);break;
case 1:
case 2:
case 3:
case 4:
case 5: printf("s=%5f",0.98*n);break;
case 6:
case 7:
case 8:
case 9:
case 10: printf("s=%5f",0.95*n);break;
default: printf("s=%5f",0.9*n);break;
}
}