Jungle Camping Problem
#include <stdio.h> #include<string.h> int main() { char sound[20]; int i=0, word=1, a; char l[]="Grr", t[]="Rawr", s[]="Ssss", b[]="Chirp"; fgets(sound,sizeof (sound),stdin); while(sound[i] != '\0') { if(sound[i]==' ' || sound[i]=='\n' || sound [i]=='\t') { word++; } i++; } for(i=0;i<word;i++) { if(strcmp(sound,l)==0) { printf ("Lion "); } else if(strcmp(sound,t)==0) { printf ("Rawr "); } else if(strcmp(sound,s)==0) { printf ("Snake "); } else if(strcmp(sound,b)==0) { printf ("Bird "); } } return 0; } Using this but only the 2nd test case come as positive. Can u tell me the problem here