16th Mar 2021, 4:35 PM
Romania005 #01
Romania005 #01 - avatar
3 Respostas
+ 2
The swap ensures that a >= b, so I'd say the condition in your loop is incorrect, and should be x >= b.
16th Mar 2021, 4:42 PM
Shadow
Shadow - avatar
+ 4
for(x = a; x >= b; x--)
16th Mar 2021, 4:56 PM
JaScript
JaScript - avatar
+ 1
what are you trying to achieve? actually the loop is never executed, as if a<b you swap var (so now b<=a) and loop check if x (initialized with a) is <=b... to run...
16th Mar 2021, 4:44 PM
visph
visph - avatar