
Write code that uses nested loops to print the following patterns:
Pattern1:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1

for(i=1;i<=6;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}

print"loops\n\n"; for ($i=1;$i<=9;$i++) {for ($k=1;$k<=$i;$k++) { print "$k ";
} print "\n" }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.