Advertisement
Guest User

Sexist Salary System

a guest
Oct 23rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.46 KB | None | 0 0
  1. #include<stdio.h>
  2. #include <ctype.h>
  3.  
  4. int main(void)
  5. {
  6.  
  7.     int Salary, Years_Service;
  8.     char Sex, Qualification;
  9.  
  10.     Sex = Qualification = '\0';
  11.     Salary = Years_Service = 0;
  12.  
  13.     printf("Enter Gender: [M/F] ");
  14.     scanf("%c",&Sex);
  15.    
  16.     printf("Enter Qualification: [G/P] ");
  17.     scanf(" %c",&Qualification);
  18.  
  19.     printf("Enter Years_Service: ");
  20.     scanf(" %d",&Years_Service);
  21.  
  22.     Sex = (char)tolower((int)Sex);
  23.     Qualification = (char)tolower((int)Qualification);
  24.  
  25.     if (Sex == 'm') {
  26.         if (Years_Service >= 10) {
  27.             if (Qualification == 'p' ) {
  28.                 Salary=15000;
  29.             } else if (Qualification == 'g' ) {
  30.                 Salary=10000;
  31.             }
  32.         } else if( Years_Service >= 0) {
  33.             if (Qualification == 'p' ) {
  34.                 Salary=7000;
  35.             } else if (Qualification == 'g' ) {
  36.                 Salary=7000;
  37.             }
  38.         }
  39.     } else if (Sex == 'F' || Sex == 'f') {
  40.         if (Years_Service >= 10) {
  41.             if (Qualification == 'p' ) {
  42.                 Salary=12000;
  43.             } else if (Qualification == 'g' ) {
  44.                 Salary=9000;
  45.             }
  46.         } else if( Years_Service >= 0) {
  47.             if (Qualification == 'p' ) {
  48.                 Salary=10000;
  49.             } else if (Qualification == 'g' ) {
  50.                 Salary=6000;
  51.             }
  52.         }
  53.     }
  54.  
  55.     printf("The expected Salary will be: %d \n ", Salary);
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement