+ 3

Why is my code not working?

https://code.sololearn.com/c8RWw6GAp4R3/?ref=app EDIT: I have placed the if (x-i==1) inside the loop but the code is still not working.

19th Apr 2018, 2:43 PM
Ibaadi Jaya
Ibaadi Jaya - avatar
5 Answers
+ 4
Thank you all for the help : ) (I hope I posted this at the right moment)
20th Apr 2018, 7:37 AM
Ibaadi Jaya
Ibaadi Jaya - avatar
+ 3
if (x-i==1) {return true; } This if statement is outside of the for loop and doesn't have access to the variable i.
19th Apr 2018, 2:48 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Sergey Semendyaev ChaoticDawg I have placed the if (x-i==1) inside the loop but the code is still not working.
19th Apr 2018, 10:38 PM
Ibaadi Jaya
Ibaadi Jaya - avatar
+ 2
Exactly. Maybe it's just me, but I've never seen anybody using figure braces like you. And maybe it's the reason you've stuck.
19th Apr 2018, 3:19 PM
Sergey Semendyaev
Sergey Semendyaev - avatar
+ 1
as I see, it works.
20th Apr 2018, 7:36 AM
Sergey Semendyaev
Sergey Semendyaev - avatar