0% found this document useful (0 votes)
77 views5 pages

Employe Pay Bill

The document contains code for an employee payroll bill preparation program. It defines a structure to store employee data including number, name, basic pay, and deductions. It inputs employee data, calculates deductions like PF, tax, DA, HRA based on basic pay, and outputs a report with employee details and net pay. Deduction percentages are different for basic pay above and below 10000. The code opens and writes to input and output files to store and display the employee data and payroll calculations.

Uploaded by

rudhra007
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views5 pages

Employe Pay Bill

The document contains code for an employee payroll bill preparation program. It defines a structure to store employee data including number, name, basic pay, and deductions. It inputs employee data, calculates deductions like PF, tax, DA, HRA based on basic pay, and outputs a report with employee details and net pay. Deduction percentages are different for basic pay above and below 10000. The code opens and writes to input and output files to store and display the employee data and payroll calculations.

Uploaded by

rudhra007
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

EMPLOYE PAY BILL PREPARATION

#include<stdio.h>
#include<conio.h>
Struct emplist
{
Int eno;
Char ename;
Longint ebpay;
Float pf;
Float tax;
Float da;
Float hra;
Float gp;
Float de;
Float npay;
}e[100];
Main()
{
Int n,I;
FILE *fp;
Clrscr();
Printf(“Enter the no of records:”);
Scanf(“%d”,&n);
For(i=1;i<=n;i++);
{
Printf(“Employe no.”);
Scanf(“%d”,& e[i].eno);
Printf(“Employe name”:);
Scanf(“%s”,e[i].ename);
Printf(“Basic pay”);
Scanf(“%ld”,&e [i].bpay);
}
fp=fopen(“in-file.dat”,”w”);
for(i=1;i<=n;i++)
fprintf(fp”%d\t%s\t%ld\n”,e[i].eno,e[i].ename,e[i].bpay);
fclose(fp);
fp=fopen(“in-file.dat”,”r”);
for(i=1;i<=n;i++)
{
fscanf(fp”%d\t%s\t%ld\n”,&e[i].eno,e[i].ename,e[i].bpay);
If(e[i].bpay>=10000)
{
E[i].pf=(3*e[i].bpay)/100;
E[i].tax=(2*e[i].bpay)/100;
E[i].da=(4*e[i].bpay)/100;
E[i].hra=(2*e[i].bpay)/100;
Printf(“\n”);
}
Fp=fopen(‘in-file”,”w’);
For(i=1;i<n;i++)
Fprintf(fp,”5d\t%s\t%ld\n”,e[i].eno,e[i].ename,e[i].bpay);
Fclose(fp);
Fp=fopen(“infile.dat”,r”);
{
{
Fscanf(fp,%d\t%s\t%ld\n”,&e[i].eno,e[i].ename,);
If(e[i].bpay>=10000)
{
E[i].pf=(3*e[i].bpay)/100;
E[i].tax=(2*e[i].bpay)/100;
E[i].da=(4*e[i].bpay)/100;
E[i].hra=(2*e[i].bpay)/100;
{
Else
{
E[i].pf=(1*e[i].bpay)/100;
E[i].tax=(0.5.e[i].bpay)/100;
E[i].da=(2*e[i].bpay)/100;
E[i].hra=(0.5*e[i].bpay)/100;
}
fclose(fp);
Fp=fopen(“out-file”,”w”);
Fprintf(fp”--------------------------------------------------------------\n”);
Fprintf(fp,”eno\t ename\t bpay\t pf\t tax\t da\t hra\t gp\t npay\n”);
Fprintf(fp,”------------------------------------------------------------\n”);
For(i=1;i<=n;i++)
{
Fprintf(fp,”%d\t%ld\t%.2f\t”,e[i].ename,e[i].bpay,e[i].pf);
Fprinf(fp,”%.2f\t%.2f\t%.2f\t”,e[i].da,e[i].hra);
Fprintf(fp,”%.2f\t%2f\t%.2f\n”,e[i].gp,e[i].npay);
}
Printf(fp,”------------------------------------------------------------\n”);
Fclose(fp)getch();
}
OUTPUT:
ENTER THE no.of records:2
Employe no:101
Employe name:ramesh
Basic pay:8000

Employe no;102
Employe name:raja
Basic pay:5000
C:\TUROC>type in-file.dat
101 ramesh 8000
102 raja 5000
C:\TURBOC>type out-file.dat
Eno ename bpay pf tax da hra npay
101 ramesh 8000 160.00 80.00 240.00 80.00 8080.00
102 raja 5000 50.00 150.00 50.00 5200.00 5050.00

You might also like