Code Competitions

Coding competition

Tuesday, 14 May 2013

program to show multiple employee records

#include<stdio.h>
#include<conio.h>
struct employee
{
    int emp_id;
    char emp_name[10];
    float salary;
};
void main()
{
    struct employee e1[10];
    int i,n;
    clrscr();
    printf("Enter number of employees");
    scanf("%d",&n);
      //    printf("Enter employee details");
    for(i=1;i<=n;i++)
    {
        printf("Enter employee %d information\n",i);
        scanf("%d%s%f",&e1[i].emp_id,e1[i].emp_name,&e1[i].salary);
    }
    printf("\ndetails : \n\n");
    for(i=1;i<=n;i++)
    {
        printf("\n\nEmployee %d",i);
        printf("\nemp_id=%d\nemp_name=%s\nemp_salary=%f3",
        e1[i].emp_id,e1[i].emp_name,e1[i].salary);
    }
getch();
}


No comments:

Post a Comment