how to make a pattern like
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
using i and j loop?
plz answer fast...
Answers
Answered by
1
int i,j,k=1;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(k + " ");
k ++;
}
System.out.println();
}
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(k + " ");
k ++;
}
System.out.println();
}
Similar questions