0
Can you please explain me the following code
I'm not getting the code https://code.sololearn.com/cxz4QDs7z7nS/?ref=app
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.
+ 1
System.out.print( p+ " "); Just give space here
0
ok but can you explain me the code
0
means the way it is working
0
thank you