- 1

What's wrong in this code

Help me wizards

1st Feb 2020, 9:38 AM
Ajith
Ajith - avatar
3 Answers
+ 1
with your logic only one string will be printed in any case.
1st Feb 2020, 9:58 AM
Bahha┣
Bahha┣ - avatar
+ 1
The task makes no assumptions about either how many noises you hear (not necessarily always three!), or about their order and combination. Your solution should be more generic to be able to handle any combination.
1st Feb 2020, 10:10 AM
Shadow
Shadow - avatar
0
#include<stdio.h> int main() { char lion[10]; char tiger[10]; char snake[10]; char bird[10]; scanf("%s %s %s %s",lion,tiger,snake,bird); if(lion=="Grr") printf("lion \n",lion); else if(tiger=="Rawr") printf ("tiger \n",tiger); else if(snake=="Ssss") printf("snake \n",snake); else if(bird=="Chirp") printf("bird \n",bird); }
1st Feb 2020, 9:38 AM
Ajith
Ajith - avatar