Code Coach: Extra Terrestrials C, failing test case #3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Code Coach: Extra Terrestrials C, failing test case #3

everything is working as expected, except for whatever reason one of the cases is failing can anyone enlighten me as to why this may be? #include <stdio.h> #include <string.h> int main() { char input[30]; int i, len; fgets(input,30,stdin); len = strlen(input); for (i = len - 1; i >= 0; i--) { printf("%c", input[i]); } return 0; }

16th Jun 2021, 2:59 AM
Earl
3 Answers
+ 1
Your program is working perfectly, looks like sololearn is providing input word sizeof which is greater than 30. Just increase the size of "input" array and it should work ( also don't forget to tell fgets() the same ) Here is the fix 👇 https://code.sololearn.com/c182l36fM91V/?ref=app
16th Jun 2021, 6:05 AM
Arsenic
Arsenic - avatar
0
Thank you! I forgot I even posted this, it passed after changing it to 100
29th Jun 2021, 4:32 AM
Earl
0
Arsenic can u help me in c++?
13th Nov 2022, 10:29 PM
sen