Write a program to enter the salary of an employ and calculate TA DA and HRA
if salary is less than or equalto 50000
TA=5%
DA=5%
HRA=4%
if salary is less than or equalto 30000
TA=5%
DA=4%
HRA=3%
if salary is less than or equalto 20000
TA=2%
DA=2%
HRA=2%
#include<stdio.h>
int main()
{
float a,b,c,d,e,gs1,gs2,gs3; //a,b,c,d,e are variable used for defining the percentage,gs1,gs2,gs3 defines the gross salary
printf("Enter the salary: ");
scanf("%f",&a);//Enter the salary of the employ
b=(5*a)/100;//Calculation of 5% for TA and DA
c=(4*a)/100;//Calculation of 4% for HRA DA
d=(a*3)/100;//Calculation of 3% for HRA
e=(a*2)/100;//Calculation of 2% for TA DA and HRA
gs1= a+b+b+c;// Calculation of gross salary above 50000
gs2=a+b+c+d;// Calculation of gross salary above 30000
gs3=a+e+e+e;// Calculation of gross salary above 20000
if(a>=50000)
printf("Gross: %f",gs1);//Printing the gross salary
else
if(a>=30000)
printf("Gross: %f",gs2);//Printing the gross salary
else
if(a>=20000)
printf("Gross: %f",gs3);//Printing the gross salary
else
printf("Gross: %f",a);//Printing the gross salary when the salary is 0
}