+ 1

Why my solution is not accepted and a wrong answer?Expert evaluation required

https://code.sololearn.com/c5S2H5HoZ3tJ This is somewhat wrong according to some online judge

24th Jul 2022, 10:09 AM
ANIK
ANIK - avatar
6 odpowiedzi
+ 1
Maybe the test does not accept the warning about the unused variable, j. Remove the declaration in line 4 of j=0.
24th Jul 2022, 10:56 AM
Brian
Brian - avatar
+ 1
Solo '\b' is a metacharacter for backspace (a.k.a. ctrl-h, or ASCII 8). I assume it is coded there intentionally to eliminate an extra space from the output formatting. ANIK Sololearn's shell ignores backspace. However, maybe that is also tripping up an automated online judge.
24th Jul 2022, 3:21 PM
Brian
Brian - avatar
+ 1
Brian , thanks for the clarification, but I mean that this is probably superfluous in solving this task, like "j=0" 😉
25th Jul 2022, 2:28 AM
Solo
Solo - avatar
0
What is it 😳 printf("\b"); } printf("\n");
24th Jul 2022, 11:42 AM
Solo
Solo - avatar
0
Brian but this shows wrong answer for some reason..idk.i looked up some solutions but they too give same answers starting from n=0..i guess i am right and found the solution.thats all i need to know!??? Even if right answer,there is still presentation error for extra space.🥹
25th Jul 2022, 8:24 PM
ANIK
ANIK - avatar
0
ANIK here is a simple fix to eliminate the trailing space: Line 11 delete trailing space Line 15 move the space to be in front of %d Comment out line 21 And don't forget line 4, delete j=0.
25th Jul 2022, 9:29 PM
Brian
Brian - avatar