0% found this document useful (0 votes)
27 views3 pages

3.2.G-Employee Payroll Program (Payroll.c)

The program calculates payroll for employees by taking employee details as input, calculating HRA, DA, IT, gross pay and net pay based on basic salary. It then outputs a payroll report listing employee ID, name, basic salary and calculated values for all employees.
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 DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

3.2.G-Employee Payroll Program (Payroll.c)

The program calculates payroll for employees by taking employee details as input, calculating HRA, DA, IT, gross pay and net pay based on basic salary. It then outputs a payroll report listing employee ID, name, basic salary and calculated values for all employees.
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 DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

3.2.

GEmployee Payroll
Program (payroll.c)
/* Payroll Generation */
#include <stdio.h>
struct employee
{
int empid;
char ename[15];
int basic;
float hra;
float da;
float it;
float
gross;
float
netpay;
};
main()
{
struct employee emp[50], *ptr;
int i, j, n;
printf("Enter No. of Employees : ");
scanf("%d", &n);
for(i=0; i<n ;i++)
{
printf("\nEnter Employee
Details\n"); printf("Enter Employee
Id
: ");
scanf("%d", &emp[i].empid);
printf("Enter Employee Name : ");
scanf("%s", emp[i].ename);
printf("Enter Basic Salary : ");
scanf("%d", &emp[i].basic);
}
ptr=emp;
for(i=0; i<n; i++)
{
ptr->hra = 0.02 * ptr>basic; ptr->da =
0.01
*
ptr->basic; ptr->it = 0.05
* ptr->basic;
ptr->gross = ptr->basic+ptr->hra+ptr>da;
ptr->netpay = ptr->gross - ptr>it;
ptr
++;
}

ptr=emp;
printf("\n\n\n\t\t\t\tXYZ & Co. Payroll\n\n");
for(i=0;i<80;i++)
printf("*"
);
printf("\nEmpId\tName\t\tBasic\t HRA\t DA\t IT\tGross\t\tNet
Pay\n\n");

for(i=0;i<80;i++)
printf("*"
);
for(i=0; i<n; i++)
{
printf("\n%d\t%-15s\t%d\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f", ptr>empid, ptr->ename,ptr->basic,ptr->hra,ptr->da,ptr->it,ptr->gross,
ptr->netpay);

ptr++;
} printf("\n");
for(i=0;i<80;i+
+)
printf("*");
}

Output
[1031@localhost pointer]$ gcc studdetail.c
[1031@localhost pointer]$ ./a.out
Enter No. of Employees : 2
Enter Employee Details
Enter Employee Id
: 436
Enter Employee Name : Gopal
Enter Basic Salary : 10000
Enter Employee Details
Enter Employee Id
: 463
Enter Employee Name : Rajesh
Enter Basic Salary : 22000
XYZ & Co. Payroll
*****************************************************************************
*** EmpId
Gross

Name

Basic

HRA

DA

IT

Net Pay

********************************************************************************
436
463

Gopal
Rajesh

10000
22000

200.00
440.00

100.00
220.00

500.00 10300.00
1100.00 22660.00

9800.00
21560.00

********************************************************************************

You might also like