2013年4月6日 星期六

[C]book page 199 problem 3 solution

int income,temp;
float tax;
printf("Please enter income >");
scanf("%d",&income);
temp=(income/1000);
switch(temp)
{
case 0:
	tax=income*0.2;
	break;
case 1:
	tax=income*0.3;
	break;
default:
	tax=income*0.4;
}
printf("Tax is %.2f\n",tax);

沒有留言:

張貼留言