C Program for Calculating and Printing Bonus and Gross Salary Based on Basic Salary

In this article, we will learn how to create a program in C that will ask the user to enter his or her basic salary as input and then compute the bonus amount (bonus will be calculated at 20% of the basic salary) and gross salary using the given basic salary of the employee.

int main()
    float basic, bonus, gross;
    printf("Enter basic salary of the Employee: ");
    scanf("%f", &basic);
    bonus = (basic*20)/100;
    gross = bonus + basic;
    printf("\nBonus = %0.2f", bonus);
    printf("\nGross = %0.2f", gross);
    return 0;

As the above program was written in the Code::Blocks IDE, here is the first snapshot of the sample run:

c program calculate bonus salary

Provide the basic salary of the employee, and the program will print the Bonus@20% and gross salary of the employee as shown here in the second snapshot of the sample run:

print gross bonus of basic salary c

Here are some of the main steps used in the above program:

C Quiz

« Previous Program Next Program »

Liked this article? Share it!

Like/follow us on social media for updates!