0
I'm having a challenge regarding the flow of a nested for loop. Does anyone know how it flows when there are 3 nested for loops
Flow of a nested for loop
2 Answers
+ 2
Yup....here u go
For(I=1;i<5;I++)//1
{
For(j=1;j<I;j++)//2
{
For(k=1;k<j;k++)//3
{
}
}
}
So when program starts it goes from 1to 2 and finally to 3 after checking all the conditions now when it has executed 3rd loop then it goes back to 2nd loop and then comes back to 3rd loop this goes on and on till the condition in 2nd loop is false and after that it goes to 1st loop and again goes to 2nd and finally to 3rd loop this process occurs till the condition in loop 1 becomes false and after that it comes out of all the three..... hoping this has done what u were expecting.
0
Thank you so much for your help