0

Can you please explain me the following code

I'm not getting the code https://code.sololearn.com/cxz4QDs7z7nS/?ref=app

17th Sep 2017, 5:10 AM
Malhar Mujumdar
Malhar Mujumdar - avatar
5 Respuestas
+ 14
It is a nested loop. The first loop goes from 1 to 5 and the second goes from 1 to the current value of the first one, each time. So (first loop value | second loop value): 1 | 1 2 | 1, 2 3 | 1, 2, 3 4 | 1, 2, 3, 4 5 | 1, 2, 3, 4, 5 altogether - 15 passes. During which, p is being increased by one, each time, and printed out.
17th Sep 2017, 5:34 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
System.out.print( p+ " "); Just give space here
17th Sep 2017, 5:14 AM
Bhavin Padia
Bhavin Padia - avatar
0
ok but can you explain me the code
17th Sep 2017, 5:19 AM
Malhar Mujumdar
Malhar Mujumdar - avatar
0
means the way it is working
17th Sep 2017, 5:20 AM
Malhar Mujumdar
Malhar Mujumdar - avatar
0
thank you
17th Sep 2017, 5:50 AM
Malhar Mujumdar
Malhar Mujumdar - avatar