# C Program to Calculate and Print Bonus & Gross using Basic Salary

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

```// Write a program in C, that accept Basic salary
// of employee and compute the bonus @20% of
// Basic salary. Then print Bonus and gross salary
// -----------codescracker.com-----------

#include<stdio.h>
#include<conio.h>
int main()
{
float basic, bonus, gross;
printf("Enter basic salary of the Employee: Rs.");
scanf("%f", &basic);
bonus = (basic*20)/100;
gross = bonus + basic;
printf("\nBonus = Rs.%0.2f", bonus);
printf("\nGross = Rs.%0.2f", gross);
getch();
return 0;
}```

As the above program was written under Code::Blocks IDE, therefore after successful build and run, here is the first snapshot of the sample run: Provide the basic salary of the employee, the program will print the Bonus@20% and gross salary of the employee as shown here in the second snapshot of the sample run: Here are some of the main steps used in above program:

• Receive basic salary of employee as input
• Now Calculate the Bonus amount by applying 20 percent of the basic salary
• And then calculate the gross salary by adding bonus and basic salary amount
• Print the value of both bonus and gross salary amount as output
• Here we have used the format specifier %0.2f to print only two digit after decimal

Tools
Calculator