Given the basic salary of a person the task is to calculate the gross salary if the company gives Dearness Allowance and Special Allowance as per the given tariff.
| Basic | Dearness Allowance (DA) | Special Allowance (SA) |
| First ₹1 to ₹10000 | 10% | 5% |
| Next ₹10001 to ₹20000 | 12% | 8% |
| Next ₹20001 to ₹30000 | 15% | 10% |
| More than ₹30000 | 20% | 12% |
C
#include <stdio.h>
int main()
{
double bSalary=0.0,gSalary=0.0,da=0.0,sa=0.0;
printf("Enter the basic salary: ");
scanf("%lf",&bSalary);
if(bSalary<=10000)
{
da=0.1*bSalary;
sa=0.05*bSalary;
gSalary=bSalary+da+sa;
}
else if(bSalary>10000&&bSalary<=20000)
{
da= ((10000-0) *0.1)+((bSalary-10000)*0.12);
sa= ((10000-0) *0.05)+((bSalary-10000)*0.08);
gSalary=bSalary+da+sa;
}
else if(bSalary>20000&&bSalary<=30000)
{
da= ((10000-0)*0.1)+((20000-10000)*0.12)+((bSalary-20000)*0.15);
sa= ((10000-0)*0.05)+((20000-10000)*0.08)+((bSalary-20000)*0.1);
gSalary=bSalary+da+sa;
}
else
{
da= ((10000-0)*0.1)+((20000-10000)*0.12)+((30000-20000)*0.15)+((bSalary-30000)*0.2);
sa= ((10000-0)*0.05)+((20000-10000)*0.08)+((30000-20000)*0.1)+((bSalary-30000)*0.12);
gSalary=bSalary + da + sa;
}
printf ("Dearness Allowance: Rs %lf \n",da);
printf ("Special Allowance: Rs %lf \n",sa);
printf ("Gross Salary: Rs %lf \n",gSalary);
return 0;
}C