Ok, so I got the following code:
The output for this isCode:int i,j=1; for(i=1; i<=3; i++){ while(j <= i){ printf("A"); j++; } printf("B\n"); j = 1; }
AB
AAB
AAAB
My initial expectation for output would be:
AB
AB
AB
But when I remove j = 1 at the bottom of for loop then I get that result. What does j=1 does to this loop so that I get AB AAB AAAB?