codescracker


c

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



« C Tutorial C Examples »

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:

c program calculate bonus salary

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:

print gross bonus of basic salary c

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


« C Tutorial C Examples »






Tools
Calculator

Quick Links
Signup - Login - Give Online Test