C Program to Calculate Gross Salary of an Employee

This C program calculates gross salary of employee using basic salary, DA, and HRA.

C Program to Calculate Gross Salary

/* C code to calculate gross salary of an employee or a person using the basic salary, DA ,HRA and pf */

#include<stdio.h>
int main()
{  
   float basic, hra, da, pf, gross;
 
   printf("\n Enter Basic Salary of Employee: ");
   scanf("%f",&basic);

   printf("\n \n Enter HRA: ");
   scanf("%f",&hra);

   printf("\n \n Enter DA: ");
   scanf("%f",&da);

   pf= (basic*12)/100;
   gross=basic+da+hra+pf;

   printf("*** Salary Information of Employee ***);
   printf("\n \n BASIC Salary: Rs.%f",basic);;
   printf("\n \n HRA: Rs.%f",hra);
   printf("\n \n Gross Salary: Rs.%f \n \n",gross);

   return 0;
}

Output:

 Enter Basic Salary of Employee:1200

 Enter HRA:120
 
 Enter D.A.:150

 *** Salary Information of Employee ***

 BASIC: Rs.1200.000000
 
 HRA: Rs.120.000000
 
 Gross: Rs.1614.000000

Explanation:

Accept the basic salary, HRA (House Rent Allowance), DA (Dearness Allowance) of an employee from user, add all the values to obtain the gross salary of an employee.