Payroll Data Entry using File handling in C

Payroll Data Entry using file handling in c

Here you will get a source code of Payroll Data Entry using File handling in C example with c language.

File Handling in c is the process for storing the data in a file using programming. It used for creating, reading, writing, deleting, manipulating, and organizing files on a storage device. Thereafter whenever we required, we can extract data from the file to work in the program.

File Handling in C

This File handling program require Employee’s details such as employee id, employee name, basic pay as input, calculates dearness allowance, house rent allowance, income tax & net salary and stores this details in files named payroll. Then again open the files in read mode and display the entire data of file.

Information of variable represents values:

eid – Employee id

ename – Employee name

basic – Basic pay

da – Dearness aloowance

hra – House rent allowance

tax – Income tax

gross – Gross salary

net – Net salary

The values of da, hra, tax, gross and net after calculated :

da=25% of basic

hra=10% of basic

gross=basic+da+hra

tax=30% of gross

net=gross-tax

Payroll Data Entry using file handling in c example

Output

Enter Employee Id, Name, Basic Pay:

101 

Sam

8000

102

Adam

7000

103

Jhon

6000

^Z

 

Contents of file:

Employee Id :101

Employee Name :Sam

Basic Pay :8000

Dearness Allowance :2000.000000

House Rent Allowance :800.000000

Income Tax :3240.000000

Net Salary :7560.000000

 

Employee Id :102

Employee Name :Adam

Basic Pay :7000

Dearness Allowance :1750.000000

House Rent Allowance :700.000000

Income Tax :2835.000000

Net Salary :6615.000000

 

Employee Id :103

Employee Name :Jhon

Basic Pay :6000

Dearness Allowance :1500.000000

House Rent Allowance :600.000000

Income Tax :2430.000000

Net Salary :5670.000000

 

 

 

Check out our other C programming Examples

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top