Address

QUESTION

You have to find the address and mobile number of the employee in the company you have to go through employee details register and find his/her mobile number

ANSWER

#include <stdio.h>
int main()
{
  int i,n,fl=0;
  struct hom
  {
    char a[20];
    long int ph;
    char pl[20];
  }hom[20];
  char f[20];
  scanf("%d",&n);
  for(i=1;i<=n;i++)
    scanf("%s\n%ld\n%s\n",hom[i].a,&hom[i].ph,hom[i].pl);
  scanf("\n%s",f);
  for(i=1;i<=n;i++)
    if(strcmp(f,hom[i].a)==0)
    {
      printf("Name Mobile Number City\n");
      printf("%s %ld %s",hom[i].a,hom[i].ph,hom[i].pl);
      fl=1;
    }
  if(fl==0)
    printf("The Entered Name is not in the Directory");
        
	return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro