Computer Science, asked by adarshsingh38, 5 months ago

Write a program that generates the following output :
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5​

Answers

Answered by kamalrajatjoshi94
2

Answer:

public class Pattern

{

public static void main(String args[ ])

{

int a,b;

for(a=1;a<=5;a++)

{

for(b=1;b<=a;b++)

{

System.out.print(a+" ");

}

System.out.println();

}

}

Output:

1

2 2

3 3 3

4 4 4 4

5 5 5 5 5

Copy paste this program in Java you will get the output.

Answered by allysia
2

Answer:

USING PYTHON

\\\tt n=int(in put("Enter\ the\ number\ of\ rows: ")) \\\tt for\ i\ in\ range(1,n): \\\tt{\qquad for\ j\ in\ range(0,i):}\\\tt {\qquad{\qquad print(i,end="")}} \\\tt {\qquad print()}

Similar questions