Q:

Write a C program to Calculate Employee and Employer Provident Fund using C program

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C programming Basic Input, Output, if else, Ternary Operator based Programs

Similar questions


need a help?


find thousands of online teachers now
Write a C program to Set buffer with specific val... >>
<< Write a C program to Print How Many Inputs are ta...