16. C Program to find the Gross Salary of an Employee.
How does this program work?
- In this programme you will learn about how to Calculate the Gross salary of an employee.
- By using the given formula gross_salary = [basic_salary + daily allowance + house_rent] we can find the answer.
- By using the below code we can easily calculate the gross salary in C programing.
Here is the code
#include <stdio.h>
int main(void)
{
float basic_salary, dallowance, house_rent, gross_salary;
printf("Enter Basic Salary: ");
scanf("%f",&basic_salary);
dallowance = 0.4 * basic_salary;
house_rent = 0.2 * basic_salary;
//Compute gross Salary
gross_salary = basic_salary + dallowance + house_rent;//Formula to find gross salary
printf("\n Basic Salary: %.2f", basic_salary);
printf("\n Dearness Allowance: %.2f", dallowance);
printf("\n House Rent: %.2f", house_rent);
printf("\n\n Gross Salary: %.2f", gross_salary);
return 0;
}