C Program for Print Gross Salary of Employee

"C" program to find gross salary of employee. Accept basic salary from user. If basic salary is less than 2000 then calculate HRA = 11% and DA = 80% of basic salary. If basic salary is equal or greater than 2000 then HRA = 600 and calculate DA = 95% of basic salary. Display gross salary. (gross salary = basic salary + HRA + DA)

Source Code
``````#include<stdio.h>
#include<conio.h>
void main()
{
float g_sal=0;
float b_sal;
float hra;
float da;
clrscr() ;
printf("Enter the basic salary: ");
scanf("%f", &b_sal);
if(b_sal < 2000)
{
hra = b_sal * 0.11;
da = b_sal * 0.80;
g_sal = b_sal + hra + da;
}
else if(b_sal >= 2000)
{
hra = 600;
da = b_sal * 0.95;
g_sal = b_sal + hra + da;
}
else
{
printf("Not valid");
}
printf("HRA = %f", hra);
printf("\nDA = %f", da);
printf("\nGross salary is %f", g_sal);
getch();
}``````
Output
``````Enter the basic salary: 1900
HRA = 209.000000
DA = 1520.000000
Gross salary is 3629.000000

Enter the basic salary: 12000
HRA = 600.000000
DA = 11400.000000
Gross salary is 24000.000000``````