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.

#include<stdio.h>
#include<conio.h>
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);
    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 Online Test


« C Tutorial C Examples »



© Copyright 2021. All Rights Reserved.

CodesCracker