Football

QUESTION

A foot ball team contains 10 players .Find a player name Ronaldo appear more than twice or appears once or not appears in an unordered name list.

ANSWER

#include <stdio.h>
#include<string.h>
struct person
{
char name[10];
int rno;
};
typedef struct person NAME;
NAME stud[10], temp[10];
int main()
{
  int i,count=0;
  char nam[]="Ronaldo";
 //char nam[] = {'R','o','n','a','l','d','o','\0'};
  //char nam[15];
 // puts(nam);
for(i = 0; i < 10; i++)
{
scanf("%s",stud[i].name);
scanf("%d",&stud[i].rno);
//temp[i] = stud[i];
}
  
for(i = 0; i < 10;i++)
{
  //printf("%s",nam);
if((strcmp(stud[i].name,nam))==0)
{
 // printf("%s\n",stud[i].name);
  count++;
}
}
  /*if(count>0 && count==1)
  printf("Ronaldo appears once in the list");
  else
     printf("Ronaldo not appears in the list");
     */
  if(count==0)
    printf("Ronaldo not appears in the list");
  else if(count>0 && count==1)
    printf("Ronaldo appears once in the list");
  else
    printf("Ronaldo appears more than once in the list");
	return 0;
}

top license

mx player for windows

kinemaster para pc kinemaster for pc

Ativador Windows

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