write a c program to Create employee record by taking
details like name, employee id, address and phone number.
While taking the phone number, take either landline or
mobile number. Ensure that the phone numbers of the employee
are unique. Also display all the details

Answers were Sorted based on User's Feedback



write a c program to Create employee record by taking details like name, employee id, address and p..

Answer / puneet mittal

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
struct Employee
{
char name[20];
int id;
char address[50];
int phno;
};
struct Employee emp[10];
int i,j;
printf("EMPLOYEES RECORD : \n\n");
for(i=0;i<2;i++)
{
printf("\n");
printf("Enter detail of Employee %d\n
",i+1);
printf("Employee name : ");
scanf("&s",&emp[i].name);
printf("Employee id no.: ");
scanf("%d",&emp[i].id);
printf("Address:");
scanf("%s",&emp[i].address);
printf("Phone number(give either
landline or mobile number):");
pass:
scanf("%d",&emp[i].phno);
if(i>0)
{
for(j=0;j<2;j++)
{
if(emp[j].phno==emp[i].phno)
{
printf("this phone number is having
employee id no. - %d ",emp[j].id);
printf("TRY AGAIN . ");
goto pass;
}
}
}
}
getch();
}

Is This Answer Correct ?    9 Yes 9 No

write a c program to Create employee record by taking details like name, employee id, address and p..

Answer / vinesh2009sharma

void main()
{
printf("enter the EMP NAME EMP ID ..........")
sca

Is This Answer Correct ?    3 Yes 10 No

Post New Answer

More C Code Interview Questions

Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

0 Answers  


main() { int i=300; char *ptr = &i; *++ptr=2; printf("%d",i); }

4 Answers   CSC,


write a program to Insert in a sorted list

4 Answers   Microsoft,


what is variable length argument list?

2 Answers  


void main() { int i=5; printf("%d",i++ + ++i); }

3 Answers  






3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

0 Answers   RoboSoft,


C program to print magic square of order n where n > 3 and n is odd

2 Answers   Accenture,


Design an implement of the inputs functions for event mode

0 Answers   Wipro,


main() { extern int i; i=20; printf("%d",i); }

1 Answers   Value Labs,


main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4

18 Answers   HCL, IBM, Infosys, LG Soft, Satyam,


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  


main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above

3 Answers   HCL,


Categories