Learn C ProgrammingLearn ProgrammingPrograms On StructuresResources

095. Define a structure Employee having elements emp_id, name,etc. Accept data and reprint it

By September 18, 2012 September 5th, 2018 No Comments
#include<stdio.h>
#include<conio.h>  

struct Employee
{
 char name[50];
 int emp_id;
 long phone_no;
};

main()
{
	struct Employee e;
	clrscr();
	printf("Enter name : ");
	scanf("%s",&e.name);
	printf("Enter emp_id: ");
	scanf("%d",&e.emp_id);
	printf("Enter Phone Number: ");
	scanf("%ld",&e.phone_no);

	printf("\n\nEnter name : %s",e.name);
	printf("\n\nEnter Emp Id       : %d",e.emp_id);
	printf("\n\nEnter Phone Number : %ld ",e.phone_no);

	getch();
}


Leave a Reply

DEMO01