Gender | Years of Service | Qualifications | Salary |
Male | >=10 | Post-Graduate | 15000 |
>=10 | Graduate | 10000 | |
<10 | Post-Graduate | 10000 | |
<10 | Graduate | 7000 | |
Female | >=10 | Post-Graduate | 12000 |
>=10 | Graduate | 9000 | |
<10 | Post-Graduate | 10000 | |
<10 | Graduate | 6000 |
Statement of C Program: Calculate the Salary of an Employee by using the Above Tabel:
#include<stdio.h>
#include<conio.h>
void main()
{
char g;
int yos , qual , sal=0;
clrscr();
printf(" Enter Gender , Years of Service and Qualification ( G=0 , PG=1 ):");
/* G stands for Graduate and PG stands for Post-Graduate */
/* G stands for Graduate and PG stands for Post-Graduate */
scanf("%c%d%d" , &g , &yos , &qual);
sal = 15000;
else if( (g=='m' && yos>=10 && qual==0) || ( g=='m' && yos<10 && qual==1 ) )
sal = 10000;
else if( g=='m' && yos<10 && qual==0)
sal = 7000;
else if( g=='f' && yos>=10 && qual==1)
sal = 12000;
else if( g=='f' && yos>=10 && qual==0)
sal = 9000;
else if( g=='f' && yos<10 && qual==1)
sal = 10000;
else if( g=='f' && yos<10 && qual==0)
sal = 6000;
printf("Salary of Employee=%d\n" , sal);
getch();
}
That's All
Output:
Enter Gender , Years of Service and Qualification ( G=0 , PG=1 ):
f 25 1
Salary of Employee=12000
That's All
why are we takinng q as int not as char
ReplyDeleteSuperbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. سلم الرواتب
ReplyDelete