Question Name:Attendance

#include <stdio.h>
#include <string.h>

struct avi
{ 
  char c[30];
} s1[20];
int main()
{
int a,i,count=0;
  char tem[30];
  scanf("%d",&a);
  for(i=0;i<a;i++) { 
    scanf("%s",s1[i].c); 
  } scanf("%s",tem);
    for(i=0;i<a;i++) { 
if(strcmp(s1[i].c,tem)==0){ count++;} 
    } 
  if(count>0) { 
    printf("%s is exist",tem);
  } 
  if(count==0)
  { printf("The Entered Name is not in the Directory");
  } 
	return 0;
}

Problem Description

There are three students Vino, Saravana and Virat in the class. You have to find the Vino in the attendance list.

  • Test Case 1

    Input (stdin)

    3
    Vino
    Saravana
    Virat
    
    Vino
    

    Expected Output

    Vino is exist
  • Test Case 2

    Input (stdin)

    3
    Anisha
    Saravana
    Virat
    
    Vino
    

    Expected Output

    The Entered Name is not in the Directory

Leave a Reply

Your email address will not be published. Required fields are marked *

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