- 1
What's wrong in this code
Help me wizards
3 Answers
+ 1
with your logic only one string will be printed in any case.
+ 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.
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);
}