Home »
C solved programs »
C basic programs
C - Calculate Employee and Employer Provident Fund using C program
In this C program, we will learn how to calculate employee and employer contribution in provident fund (pf) based on basic pay using c program?
In this program, we define two macros for employee and employee fund contribution percentage and taking basic pay as input, based on this percentage, program is calculating provident fund (pf) which is deducting from your salary and employer is contributing.
Calculate Employee and Employee Provident Fund Contribution using C Program
/*C - Calculate Employee and Employer
Provident Fund using C Program.*/
#include <stdio.h>
#define EMPLOYEE_PERCENTAGE 12.5f
#define EMPLOYER_PERCENTAGE 12.0f
int main(){
float basicPay;
float employeeFund,employerFund;
printf("Enter basic pay: ");
scanf("%f",&basicPay);
employeeFund=(basicPay/100)*EMPLOYEE_PERCENTAGE;
employerFund=(basicPay/100)*EMPLOYER_PERCENTAGE;
printf("Basic Pay: %f\n",basicPay);
printf("Employee contribution: %f\n",employeeFund);
printf("Employer Contribution: %f\n",employerFund);
return 0;
}
Output
Enter basic pay: 35000
Basic Pay: 35000.000000
Employee contribution: 4375.000000
Employer Contribution: 4200.000000
C Basic Programs »