Employee Bonus Calculation: C

In this c program, we ask the user/employee to enter current year and his / her year of joining the organization/company. We check if the employee has served the company / organization for more than 3 years. If yes, then we give him/her a bonus of $2500 and if he or she has served for less than 3 years we’ll give $1000 as bonus.

Related Read:
if else statement in C
Relational Operators In C

Source Code: Employee Bonus Calculation: C

  1.    
  2. #include < stdio.h >  
  3.   
  4. int main()  
  5. {  
  6.     int bonus, cy, yoj;  
  7.   
  8.     printf("Enter current year and year of joining\n");  
  9.     scanf("%d %d", &cy, &yoj);  
  10.   
  11.     if( (cy - yoj) > 3 )  
  12.     {  
  13.         bonus = 2500;  
  14.     }  
  15.     else  
  16.     {  
  17.         bonus = 1000;  
  18.     }  
  19.   
  20.     printf("You get a bonus of %d \n", bonus);  
  21.   
  22.     return 0;  
  23. }  

Output 1:
Enter current year and year of joining
2019
2017
You get a bonus of 1000

Output 2:
Enter current year and year of joining
2019
2014
You get a bonus of 2500

C Program to Calculate Employee Bonus


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

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


In this program we check if the employee has worked for 3 years in the organization or not. We subtract his year of joining from current year and then based on that we decide his or her bonus.

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