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) |
| Upto ₹10000 | 10% | 5% |
| From ₹10001 to ₹20000 | 12% | 8% |
| From ₹20001 to ₹30000 | 15% | 10% |
| ₹30001 and above | 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=0.12*bSalary;
sa=0.08*bSalary;
gSalary=bSalary+da+sa;
}
else if(bSalary>20000&&bSalary<=30000)
{
da=0.15*bSalary;
sa=0.1*bSalary;
gSalary=bSalary+da+sa;
}
else
{
da=0.2*bSalary;
sa=0.12*bSalary;
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