Computer Science, asked by pratikturkar306, 1 year ago

Generate the following pattern in java using loops :
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

Answers

Answered by prakriti27
4
class Loop
{
void main()
{
int i, j, p=1;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
System.out.print(p);
p++;
}
System.out.println();
}
}
}

prakriti27: pls mark as best.....
Similar questions