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
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 |
Answer / vinesh2009sharma
void main()
{
printf("enter the EMP NAME EMP ID ..........")
sca
Is This Answer Correct ? | 3 Yes | 10 No |
How can you relate the function with the structure? Explain with an appropriate example.
main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }
#include"math.h" void main() { printf("Hi everybody"); } if <stdio.h> will be included then this program will must compile, but as we know that when we include a header file in "" then any system defined function find its defination from all the directrives. So is this code of segment will compile? If no then why?
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)
plz send me all data structure related programs
main() { int i=10; void pascal f(int,int,int); f(i++,i++,i++); printf(" %d",i); } void pascal f(integer :i,integer:j,integer :k) { write(i,j,k); }
main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
void main() { int i=i++,j=j++,k=k++; printf(“%d%d%d”,i,j,k); }
main() { printf("%d", out); } int out=100;
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above