实验课2继续2
#include"stdio.h"
int main(){
double a,rate,tax,profit;
while(1){
scanf("%lf",&a);
if(a<500)
rate=0;
else if(a<1000)
rate=0.05;
else if(a<2000)
rate=0.08;
else if(a<5000)
rate=0.10;
else
rate=0.15;
tax=a*rate;
profit=a-tax;
printf("a=%lf,rate=%lf,tax=%lf,profit=%lf\n",a,rate,tax,profit);
}return 0;
}
#include"stdio.h" int main(){ double a,rate,tax,profit,d; while(1){ scanf("%lf",&a); d=a/500; switch((int)d){ case 0:rate=0;break; case 1:rate=0.05;break; case 2:rate=0.08;break; case 3: case 4:rate=0.10;break; case 5: case 6: case 7: case 8: case 9: case 10:rate=0.15;break; }
tax=a*rate; profit=a-tax; printf("a=%lf,rate=%lf,tax=%lf,profit=%lf\n",a,rate,tax,profit); }return 0; }