Skip to content

Instantly share code, notes, and snippets.

@VishalVishwakarma
Created March 2, 2017 07:36
Show Gist options
  • Save VishalVishwakarma/6c7b5ff31a902d9276bca98484221ac1 to your computer and use it in GitHub Desktop.
Save VishalVishwakarma/6c7b5ff31a902d9276bca98484221ac1 to your computer and use it in GitHub Desktop.
Simple employee salary payroll program in C using structure
#include<stdio.h>
#include<conio.h>
struct emp
{
int empno ;
char name[10] ;
int bpay, allow, ded, npay ;
} e[10] ;
void main()
{
int i, n ;
printf("Enter the number of employees : ") ;
scanf("%d", &n) ;
for(i = 0 ; i < n ; i++)
{
printf("\nEnter the employee number : ") ;
scanf("%d", &e[i].empno) ;
printf("\nEnter the name : ") ;
scanf("%s", e[i].name) ;
printf("\nEnter the basic pay, allowances & deductions : ") ;
scanf("%d %d %d", &e[i].bpay, &e[i].allow, &e[i].ded) ;
e[i].npay = e[i].bpay + e[i].allow - e[i].ded ;
}
printf("\nEmp. No. Name \t Bpay \t Allow \t Ded \t Npay \n\n") ;
for(i = 0 ; i < n ; i++)
{
printf("%d \t %s \t %d \t %d \t %d \t %d \n", e[i].empno,
e[i].name, e[i].bpay, e[i].allow, e[i].ded, e[i].npay) ;
}
getch() ;
}
@Rdsg007
Copy link

Rdsg007 commented May 8, 2024

Sir in line 19 amberson is missed I think sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment