main()
{
float p,d,f
printf("please inout consumption\袜御老n")
scanf("%f",&p)
if(p<100)
{m==0
f=p}
else if(p>告升=100&&p<200)
{m==o.o5
f=(1-0.05)*p}
else if(p>=200&&p<500)
{m==0.1
f=(1-0.1)*p}
else if(p>=500&&p<1000)
{m==0.15
f=(1-0.15)*p}
else(p>=1000)
{m==o.2
f=(1-0.2)*p}
printf("discount is %f,amount is %f",m,f)
}
试试看!
#include <stdio.h>void main()
{
int age
printf("please input the child age:"脊睁)
scanf("%d",&age)
switch(age)
{
case 2:
case 3: printf("%d,enter the Lower class.\n",age)break
case 4: printf("%d,enter the Middle class.\n",age)break
case 5:
case 6: printf("樱拿岁敏局%d,enter the Higher class.\n",age)break
default : printf(" you chlid shuld goto more Higher class.\n")break
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)