Input basic salary of an employee and calculate its Gross salary
Calculate salary according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
Sample Output
Enter employee basic salary: 25000 Gross Salary: 56250.00 Process returned 0 (0x0) execution time : 6.148 s Press any key to continue.
Source Code
#include<stdio.h>
int main()
{
float basicSalary, grossSalary, hra, da;
printf("Enter employee basic salary: ");
scanf("%f", &basicSalary);
if(basicSalary <= 10000)
{
hra = basicSalary * 0.2;
da = basicSalary * 0.8;
grossSalary = basicSalary + hra + da;
}
else if(basicSalary <= 20000)
{
hra = basicSalary * 0.25;
da = basicSalary * 0.9;
grossSalary = basicSalary + hra + da;
}
else if (basicSalary > 20000)
{
hra = basicSalary * 0.3;
da = basicSalary * 0.95;
grossSalary = basicSalary + hra + da;
}
printf("\nGross Salary: %0.2f\n", grossSalary);
return 0;
}
Sample Output
Enter employee basic salary: 25000 Gross Salary: 56250.00 Process returned 0 (0x0) execution time : 2.081 s Press any key to continue.
No comments:
Post a Comment