+ 10

Please somebody find the logic error in the jungle campign code. While testing it shows 5th test error

#include <stdio.h> #include<string.h> int main() { char a[6],b[6],c[6],d[6]; scanf("%s",a); scanf("%s",b); scanf("%s",c); scanf("%s",d); if(strcmp(a,"Grr")==0) printf("Lion "); if(strcmp(a,"Ssss")==0) printf("Snake "); if(strcmp(a,"Chirp")==0) printf("Bird "); if(strcmp(a,"Rawr")==0) printf("Tiger "); if(strcmp(b,"Grr")==0) printf("Lion "); if(strcmp(b,"Ssss")==0) printf("Snake "); if(strcmp(b,"Chirp")==0) printf("Bird "); if(strcmp(b,"Rawr")==0) printf("Tiger "); if(strcmp(c,"Grr")==0) printf("Lion "); if(strcmp(c,"Ssss")==0) printf("Snake "); if(strcmp(c,"Chirp")==0) printf("Bird "); if(strcmp(c,"Rawr")==0) printf("Tiger "); if(strcmp(d,"Grr")==0) printf("Lion "); if(strcmp(d,"Ssss")==0) printf("Snake "); if(strcmp(d,"Chirp")==0) printf("Bird "); if(strcmp(d,"Rawr")==0) printf("Tiger "); }

6th Jul 2020, 2:51 PM
Bipul
Bipul - avatar
3 Respuestas
+ 36
#include <stdio.h> #include<string.h> int main() { char a[600],b[600],c[600],d[600], e[600],f[600],g[600],h[600],i[600]; scanf("%s",&a); scanf("%s",&b); scanf("%s",&c); scanf("%s",&d); scanf("%s",&e); scanf("%s",&f); scanf("%s",&g); scanf("%s",&h); scanf("%s",&i); if(strcmp(a,"Grr")==0) printf("Lion "); if(strcmp(a,"Ssss")==0) printf("Snake "); if(strcmp(a,"Chirp")==0) printf("Bird "); if(strcmp(a,"Rawr")==0) printf("Tiger "); if(strcmp(b,"Grr")==0) printf("Lion "); if(strcmp(b,"Ssss")==0) printf("Snake "); if(strcmp(b,"Chirp")==0) printf("Bird "); if(strcmp(b,"Rawr")==0) printf("Tiger "); repeat this process with ...c, d,e,f,g,h,I. then complie it. you will find all test cases correct.
6th Jul 2020, 7:33 PM
Saurabh
Saurabh - avatar
+ 11
While I code in python, there is need 7 times to get 5th test success. So, you need 7 times checking or equivalent to a till g
6th Jul 2020, 4:42 PM
᮴Ridwan_
᮴Ridwan_ - avatar
+ 6
Thanks
7th Jul 2020, 10:20 AM
Bipul
Bipul - avatar