+ 2
I dont understand what happends when theres 2 for loops inside 1 statement can anyone explain? I tried to work it out but still.
for(int x = 1; // value of x = 1 x<=5; // 1 less or equal to 5 is true x++) // increment 1 before prefix { for(int y = 1; // value of x = 1 y<=x; // 1 less or equal to 1 true y++) // increment 1 before prefix { System.out.print("*"); } System.out.println(); }
5 Antworten
+ 3
when inner loop completes a cycle the value In outerloop changes until until the outerloop reaches its limits
+ 2
thanks thats easier to understand
+ 1
ali said the answer which is correct as i underatand it now.
0
Are that conditions x=1,y<=x hold at the same time?If it is,you can try “x=1 and x<=y”.
If I'm mistaken,Please guide,thanks!
0
i got confused