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

 
#include < stdio.h >

int main()
{
    int bonus, cy, yoj;

    printf("Enter current year and year of joining\n");
    scanf("%d %d", &cy, &yoj);

    if( (cy - yoj) > 3 )
    {
        bonus = 2500;
    }
    else
    {
        bonus = 1000;
    }

    printf("You get a bonus of %d \n", bonus);

    return 0;
}

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

Leave a Reply

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