Blogger templates

Pages

Wednesday, 20 June 2012

Write a Program to Calculate the salary of an Employee as per the following Tabel:



  Gender Years of Service Qualifications   Salary
  Male      >=10Post-Graduate  15000
     >=10Graduate 10000
      <10Post-Graduate 10000
      <10Graduate  7000
 Female      >=10 Post-Graduate 12000
     >=10 Graduate   9000
      <10Post-Graduate  10000
      <10Graduate   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 */
scanf("%c%d%d" , &g , &yos , &qual);

if(g=='m' && yos>=10 && qual==1)
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();
}

Output:
Enter Gender , Years of Service and Qualification ( G=0 , PG=1 ):
f  25  1
Salary of Employee=12000 

                                                             That's All

0 comments:

Post a Comment