Question: Here is my code: #include #include int main() { int i, l; char s[50]; // Get Input scanf(%s,&s); while(!(strcmp(s,Done)==0 || strcmp(s,done)==0 || strcmp(s,d)==0)){ l =

Here is my code:

#include

#include

int main()

{

int i, l;

char s[50];

// Get Input

scanf("%s",&s);

while(!(strcmp(s,"Done")==0 || strcmp(s,"done")==0 || strcmp(s,"d")==0)){

l = strlen(s);

for(i = l-1;i>=0;i--){

printf("%c",s[i]);

}

printf(" ");

// Asking the user to enter strings to reverse until the

// user enters "done", "Done" or "d". If users enters

// "done", "Done" or "d" the loop will terminate.

scanf("%s",&s);

}

return 0;

}

I need the answer to be:

ereht olleH

yeH

When input is:

Hello there

Hey

done

What am I doing wrong?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!