Tuesday, July 04, 2006

Gross salary C Program (data from Table)

This program is written on the basis of the given data in the form of a table.


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























#include<stdio.h>
main ()
{

char g;
int yos, qual, sal;

printf ("Enter Gender, Years of Service and Qualifications (0=G, 1=PG):");
scanf ("%c %d %d", &g, &yos, &amp;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==0)

sal=12000;
else if (g=='f' && yos>=10 && qual==1)

sal=9000;
else if (g=='f' && yos<10 && qual==1)

sal = 10000;
else if (g=='f' && yos<10 && qual==0)

sal=6000;

printf ("\nSalary of Employee = Rs.%d\n", sal);

}



The file can be found at:
Download File

2 comments:

salman sani said...

awsum thanxxxxxxxxxxxxxxxxxxxxxxxx alot realy thankful to u :) :*

muhammad bilal said...

If costP rice and sellingP rice of an item is input through the keyboard, write a program to that
tells seller is at profit or loss? Further, it should ask user to enter ‘C’ if s/he wants to know how
much profit or loss seller incurred.