C Program to calculate the tax rate for the gross salary of an employee based on the given condition:
Program to calculate the tax rate for the gross salary of an employee based on the given condition:
Gross<2000- No Tax, 2000>=Gross<4000- 3%, 4000>=gross<5000 - 5% >=5000- 8%. Implement using Switch statement.
#include<stdio.h>
main()
{
int index,tax,gross;clrscr();
printf("\nEnter the Gross Salary\n");
scanf("%d",&gross);
index=gross/1000;
switch(index)
{
case 0:
case 1: tax=0;
break;
case 2:
case 3: tax=3;
break;
case 4: tax=5;
break;
case 5:
default: tax=8;
}
printf("\nTax Rate =%d\%",tax);
getch();
}
Comments
Post a Comment