C Program For An Employee Salary Using Structures

#include<stdio.h>
#include<conio.h>
type def struct
{
                int empid;
                chat name[30];des[20];qual[20];don[20];
                long int sal;
 }
                employee;
                void main()
    {
                employee e[100];
                int n,i;
                clrscr();
                printf("enter number of employees");
                scanf("%d",&n);
                for(i=0;i<n;i++)
                   {
                                printf("enter employee id number");
                                scanf("%d",&e[i].empid);
                                printf("enter name");
                                printf("enter date of birth in dd/mm/yyyy format");
                                flush all();
                                gets(e[i].dob);
                                printf("enter qualification");
                                flsuh all();
                                gets(e[i].qual);
                                printf("enter designation");
                                flush all();
                                gets(e[i].des);
                                printf("enter salary");
                                scanf("%d",&e[i].sal);
                    }
                    printf("employee details are \n");
                    for(i=0;i<n;i++)-
                    {
                                printf("employee id number is %d\n",e[i].empid);
                                printf("name:");
                                puts (e[i].name);
                                printf("\n date of birth:");
                                puts(e[i].dob);
                                printf("\n qualification:");
                                puts(e[i].qual);
                                printf("\n designation:");
                                puts(e[i].des);
                                printf("\n salary:%Ld",e[i].sal);
                     }
                   getch();
                }


Bhanu Namikaze

Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.

No comments:

Post a Comment