506第四组课后习题

 1 #include<stdio.h>
 2 main()
 3 {
 4     int x,y;
 5     float tax;
 6     printf("Enter income:");
 7     scanf("%d",&x);
 8     printf("\n");
 9     y=x/400;
10     switch(y)
11     {
12         case 0:
13         case 1:tax=0;break;
14         case 2:tax=(x-800)*0.05;break;
15         case 3:
16         case 4:tax=400*0.05+(x-1200)*0.08;break;
17         case 5:
18         default:tax=400*0.05+800*0.08+(x-2000)*0.20; 
19     }
20     printf("Tax=%.2f\n",tax);
21  } 

 

posted @ 2019-03-31 17:45  钟意你啊  阅读(95)  评论(1编辑  收藏  举报