C Program to Calculate Gross Salary of an Employee


In a company an employee is paid as under: If his basic salary is less than 5000 then he’ll get 10% of his base salary as HRA and 90% of his base salary as DA. If his basic salary is above 5000, then he’ll get 600 HRA and 95% of his base salary as DA.

HRA – House Rent Allowance.
DA – Dearness Allowance.

C Program to Calculate Gross Salary of an Employee


[youtube https://www.youtube.com/watch?v=qqbhNjWedLw]

YouTube Link: https://www.youtube.com/watch?v=qqbhNjWedLw [Watch the Video In Full Screen.]


Source Code: Calculate Gross Salary of an employee

  1. #include < stdio.h >  
  2.   
  3. int main()  
  4. {  
  5.     float bs, gs, da, hra;  
  6.   
  7.     printf("Enter basic salary\n");  
  8.     scanf("%f", &bs);  
  9.   
  10.     if( bs < 5000 )  
  11.     {  
  12.         hra = bs * 10 / 100;  
  13.         da  = bs * 90 / 100;  
  14.     }  
  15.     else  
  16.     {  
  17.         hra = 600;  
  18.         da  = bs * 95 / 100;  
  19.     }  
  20.   
  21.     gs = bs + da + hra;  
  22.   
  23.     printf("Gross Salary is Rs %f\n", gs);  
  24.   
  25.     return 0;  
  26. }  

Output 1:
Enter basic salary
5500
Gross Salary is Rs 11325.000000

Output 2:
Enter basic salary
4000
Gross Salary is Rs 8000.000000

Formula to calculate Gross Salary is:
Gross Salary = Basic Salary + Dearness allowance + House Rent Allowance.

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert

Leave a Reply

Your email address will not be published. Required fields are marked *