In the first example the value of p is reset to 1 on each iteration for i. In the second example the value of p is set just once and then is never reset, so it’s accumulating in all of the iterations of the loop over i.
1
solved I need Help about Loop [closed]