Type the Question

Saturday, February 16, 2019

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

No comments:

Post a Comment

Question Name:TOWER OF HANOI

#include < bits / stdc ++. h > #define lli long long using namespace std ; lli dp [ 202 ]; int main () { int t , n ; ...