Program:
/* To enter employee number , name, grade, basic salary. Calculate and display HRA, DA, TA, IT, PF, gross salary, deductions and net salary by the following table. */
Grade | Basic | HRA | DA | TA | IT | PF |
---|---|---|---|---|---|---|
A | <=2000 | 10% | 15% | 3% | 0 | 5% |
A | >2000 & <=5000 | 15% | 20% | 5% | 3% | 8% |
A | >5000 | 20% | 25% | 8% | 5% | 12% |
B | <=3000 | 8% | 10% | 12% | 0 | 4% |
B | >3000 & <=5000 | 10% | 12% | 4% | 2% | 8% |
B | >5000 | 15% | 18% | 5% | 4% | 10% |
*/
#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
int eno;
char ename[20], gr;
float basic, hra, da, ta, it, pf, gs, ded, ns;
clrscr();
printf("Enter Employee Number : ");
scanf("%d", &eno);
printf("Enter Employee Name : ");
fflush(stdin);
gets(ename);
printf("Enter Employee Grade : ");
scanf("%c", &gr);
if(gr!='A' && gr!='a' && gr!='B' && gr!='b')
{
printf("Invalid Grade");
getch();
exit(0);
}
else
{
printf("Enter Basic Salary : ");
scanf("%f", &basic);
if(gr=='a' || gr=='A')
{
if(basic<=2000)
{
hra=(basic*10)/100;
da=(basic*15)/100;
ta=(basic*3)/100;
it=0;
pf=(basic*5)/100;
}
else if(basic<=5000)
{
hra=(basic*15)/100;
da=(basic*20)/100;
ta=(basic*5)/100;
it=(basic*3)/100;
pf=(basic*8)/100;
}
else
{
hra=(basic*20)/100;
da=(basic*25)/100;
ta=(basic*8)/100;
it=(basic*5)/100;
pf=(basic*12)/100;
}
}
else
{
if(basic<=3000)
{
hra=(basic*8)/100;
da=(basic*10)/100;
ta=(basic*2)/100;
it=0;
pf=(basic*4)/100;
}
else
{
hra=(basic*10)/100;
da=(basic*22)/100;
ta=(basic*4)/100;
it=(basic*2)/100;
pf=(basic*8)/100;
}
else
{
hra=(basic*15)/100;
da=(basic*18)/100;
ta=(basic*5)/100;
it=(basic*4)/100;
pf=(basic*10)/100;
}
}
}
gs=basic+hra+da+ta;
ded=it+pf;
ns=gs-ded;
clrscr();
printf("EMPLOYEE SALARY DETAILS");
printf("\nEmployee Number : %d", eno);
printf("\nEmployee Name : %s", ename);
printf("\nEmployee Grade : %c", gr);
printf("\nEmployee Basic Salary : %.2f", basic);
printf("\nEmployee House Rent Allowence : %.2f", hra);
printf("\nEmployee Dearness Allowence : %.2f", da);
printf("\nEmployee Travelling Allowence : %.2f", ta);
printf("\nEmployee Income Tax : %.2f", it);
printf("\nEmployee Provident Fund : %.2f", pf);
printf("\nEmployee Gross Salary : %.2f", ga);
printf("\nEmployee Deductions : %.2f", ded);
printf("\nEmployee Net Salary : %.2f", ns);
getch();
}
Next Topic :
Previous Topic :
No comments:
Post a Comment