0

How is that ‘for’ logic works on Java?

I was playing some challenge on Java and that code below appeared to me. I can’t understand how that output is 200, if someone can put the step by step to help me I’ll be grateful https://code.sololearn.com/c3er7y735ve0/?ref=app

10th Sep 2018, 1:14 PM
Elias Toledo
Elias Toledo - avatar
2 odpowiedzi
+ 3
The outer for runs 10 times it subtract 10 from x resulting in subtract 100 from x. The inner for runs 3 * 10 = 30 times it add 10 to x resulting in adding 300 to x so x = 300-100=200
10th Sep 2018, 1:30 PM
Osama Mohamed
+ 1
Thank you, Osama!! It helped me a lot!
10th Sep 2018, 1:40 PM
Elias Toledo
Elias Toledo - avatar