+ 5
x = 1;for(;x = <6; x+=2){ ×=×*×;} alert(×) The answer is 11, how? Edited i changed to x
There no math and digit which multiplies by itself and caused 11 excluding float.
5 Answers
+ 10
https://code.sololearn.com/WDHGc64OlHJ9/?ref=app
I think this is your question
x=1
x<=6 true
x=x*x=1
x=1+2=3
x<=6 true
x=3*3=9
x=9+2=11
x<=6 false
+ 4
I don't believe you shared the exact code. It contains errors, and multiplying 1 by 1 will always be one. I have seen another challenge that I think you are thinking about:
let i = 1;
for (; i <= 6; i++) {
i = i * i;
}
alert(i);
Let's run through it:
i = 1
i = i * i //1
i += 2 //3
i = i * i //9
i += 2 //11
At this point, it stops the loop, since the condition is false
+ 1
the answer is "16"
- 2
how old a you jelena/helena?
- 2
Мне двадцать лет! Это класс!