Namelist

QUESTION

HoD have to find the name having registration number 103101 in the final year name list. Names will be in alphabetical order, HoD have to check each and every name in the name list to identify the particular registration number.

ANSWER

#include <stdio.h>
struct stud
{
  char name[10];
  int no;
};
int main()
{
	struct stud s[10];
  	int f=0,i=0,n=10;
  	while(n--)
    {
      scanf("%s%d",s[i].name,&s[i].no);
      i++;
    }
  	for(i=0;i<=10;i++)
    {
        if (s[i].no==103101)
        f=1;
    }
  	if (f==1)
        printf("Student register number 103101 is exist");
      else
        printf("Student register number 103101 is not exist");
	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.