Nested loop or so-called nested loop is a loop where there is repetition in the loop. Up to what level? Depending on the needs of problem you want solved. For the 3-dimensional computation can involve 3 levels or even more.
Program :
public class nested_loop {
public static void main(String[] args) {
int i,j;
for (i=1; i<=5; i++)
{
for (j=1; j<=i; j++)
{
System.out.print(j);
}
System.out.println();
}
}
}
Tidak ada komentar:
Posting Komentar