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

Comments

Unknown said…
awsum thanxxxxxxxxxxxxxxxxxxxxxxxx alot realy thankful to u :) :*
Unknown 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.
Anonymous said…
#include

int main()
{
int cp,sp, amt;

printf("Enter cost price: ");
scanf("%d", &cp);

printf("Enter selling price: ");
scanf("%d", &sp);

if(sp > cp)
{
amt = sp - cp;
printf("Profit = %d", amt);
}
else if(cp > sp)
{
amt = cp - sp;
printf("Loss = %d", amt);
}
else
{
printf("No Profit No Loss.");
}

return 0;
}

Popular posts from this blog

C Program - Calculation of Area and Circumference of a Circle using Pointers

Matchstick Game using C Programming

C Program to Calculate Factorial of a number using Recursion