Write a C program to find the net salary of the employee.

Source Code

#include<stdio.h>

int main (int argc, char *argv[])
{
  /* Base/Basic Salary (bs) Gross Salary (gs) Net Salary (ns) Dearness Allowance (da) House Rent Allowance (hra) Provident Fund (pf) Prof Tax Rs. 200 Medical/Health Insurance Premium (mi) */
     
  float bs = 0, gs = 0, ns = 0, pf = 0, da = 0, hra = 0, mi = 0;
  printf("Enter the basic salary of the Employee:");
  scanf("%f", &bs);
  
  /* Dearness Allowance */
  da = (22 * bs) / 100;
  
  /* House Rent Allowance */
  hra = (15 * bs) / 100;
  
  /* Provident Fund */
  pf = (12 * (bs + da)) / 100;
  
  /* Gross Salary */
  gs = bs + da + hra;
  
  /* Net Salary */
  ns = gs - pf - mi - 200;
  
  printf("Base/Basic Salary : %.2f\n", bs);
  printf("House Rent Allowance : %.2f\n", hra);
  printf("Dearness Allowance : %.2f\n", da);
  printf("Provident Fund : %.2f\n", pf);
  printf("Gross Salary : %.2f\n", gs);
  printf("Net salary of the employee is: %.2f", ns);
  
}

Output:

Enter the basic salary of the Employee:20000
Base/Basic Salary  : 20000.00
House Rent Allowance : 3000.00
Dearness Allowance : 4400.00
Provident Fund : 2928.00
Gross Salary : 27600.00
Net salary of the employee is: 24672.00

Find More from our code collection
Armstrong number, binary number to a decimal number, bubble sort, decimal number to binary number, factorial of the given number factors, fibonacci numbers, HCF and LCM, matrix, mergesort, salary of the employee. palindrome, quadratic equation, star patterns, series etc. and much more...
#Return to Example Source Code