C Program To Determine Gross Salary Of A Person
#include<stdio.h> #include<conio.h> void main() { int basic; float gross,da, ta; clrscr(); printf("\n Enter Basic Salary : "); scanf("%d", &basic); da = 0.1 * basic; ta = 0.12 * basic; gross = basic + da + ta; printf("\n Your Gross Salary is : %.2f",gross); getch(); }
Output:
In the above program, we calculated the gross salary of a single person by taking the basic salary. Now, we will calculate gross salary of different employees, according to their years of experience.
We will refer to the following chart.
Years Of Experience
|
Basic
Salary
|
Dearness Allowance
|
Travelling Allowance
|
>=25 years
|
50000
|
2%
|
4%
|
>=10 years
|
30000
|
2%
|
4%
|
>=5 years
|
20000
|
5%
|
7%
|
>=2 years
|
12000
|
5%
|
7%
|
>2 years
|
8000
|
6%
|
8%
|
C Program To Calculate Gross Salary Of An Employee
#include<stdio.h> #include<conio.h> void main() { int y; float basic,ta,da,gross; clrscr(); printf("\n Enter Your Years Of Experience : "); scanf("%d",&y); printf("\n *********************************"); // Ladder If Statement // if(y>=25) { basic=50000; da=0.02*basic; ta=0.04*basic; gross=basic+da+ta; } else if(y>=10) { basic=30000; da=0.02*basic; ta=0.04*basic; gross=basic+da+ta; } else if(y>=5) { basic=20000; da=0.05*basic; ta=0.07*basic; gross=basic+da+ta; } else if(y>=2) { basic=12000; da=0.05*basic; ta=0.07*basic; gross=basic+da+ta; } else { basic=8000; da=0.06*basic; ta=0.08*basic; gross=basic+da+ta; } printf("\n\n Your Basic Salary is: %.0f",basic); printf("\n\n Your Gross Salary is : %.2f",gross); printf("\n\n *********************************"); getch(); }
Output:
In this way, we can calculate the gross salary of a person or employees using this c program.