How for loop is done if we use more loop? if You Know Give Example. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How for loop is done if we use more loop? if You Know Give Example.

11th Jun 2018, 3:58 PM
yomiif Habtamu
yomiif Habtamu - avatar
4 Answers
+ 1
You have to change the name of the index, usually in this order: i, j, k. Here is an example: for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) { //Some code... //Here you can use both i and j } //Here you should use only i, not j }
18th Jun 2018, 4:42 PM
Daniele Lasagno
Daniele Lasagno - avatar
0
What do you mean? You want to replicate the for loop with another type of loop, or you want to nest a for loop inside a for loop?
13th Jun 2018, 9:47 AM
Daniele Lasagno
Daniele Lasagno - avatar
0
yes nested loop.
18th Jun 2018, 4:09 PM
yomiif Habtamu
yomiif Habtamu - avatar
0
ok Thank's
22nd Jun 2018, 5:27 AM
yomiif Habtamu
yomiif Habtamu - avatar