+ 3
Saying code is not correct in code coach even though outputs are same
Language: C Code coach: EXTRA TERRESTRIAL #include<stdio.h> #include<string.h> int main() { char str[50]; scanf("%s",&str); int len,i; len=strlen(str); for(i=len;i>=0;i--){ printf("%c",str[i]); } return 0; } ANYONE TELL WHERE I DID THE MISTAKE
1 Réponse
+ 10
You are also displaying the NULL character which was there at the end of the string while printing the reverse string.
Start your loop from (len-1) to fix it 👇
https://code.sololearn.com/cK7x49lnSNMK/?ref=app