176. C Program to Store Employee Records in Tabular Formate.
How does this program work?
- This Program is used to store employe records in tabular formate.
Here is the code
struct Employee
{
int Id;
char Name[25];
int Age;
long Salary;
float da, hra, ta;
float pf,tax;
};
int main(void)
{
int i;
struct Employee Emp[ 3 ]; //Statement 1
for(i=0;i<2;i++)
{
printf("\nEnter details of %d Employee",i+1);
printf("\n\tEnter Employee Id : ");
scanf("%d",&Emp[i].Id);
printf("\n\tEnter Employee Name : ");
scanf("%s",&Emp[i].Name);
printf("\n\tEnter Employee Age : ");
scanf("%d",&Emp[i].Age);
printf("\n\tEnter Employee Salary : ");
scanf("%ld",&Emp[i].Salary);
printf("Enter DA ($): ");
scanf("%f",&Emp[i].da);
printf("Enter PF ($): ");
scanf("%f",&Emp[i].pf);
printf("\n\tEnter TAX : ");
scanf("%ld",&Emp[i].tax);
printf("Enter HRA ($): ");
scanf("%f",&Emp[i].hra);
printf("Enter TA ($): ");
scanf("%f",&Emp[i].ta);
}
printf("\nDetails of Employees");
for(i=0;i<2;i++)
printf("\n%d\t%s\t%d\t%ld\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f",Emp[i].Id,Emp[i].Name,
Emp[i].Age,Emp[i].Salary,Emp[i].hra,Emp[i].ta,Emp[i].da,Emp[i].pf,Emp[i].tax);
return 0;
}