Computer Science, asked by hembramchandana0, 3 months ago


write a program in java to display the following pattern
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 2 1
1 2 1
1​

Answers

Answered by IndiasDaughter
1

class Pattern

{

void main (int n )

{

int rows = 5;

int rows = 5; for (int i = 1; i <= rows; ++i) {

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) {

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) { System.out.print("* ");

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) { System.out.print("* "); }

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) { System.out.print("* "); } System.out.println();

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) { System.out.print("* "); } System.out.println(); }

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) { System.out.print("* "); } System.out.println(); } }

int rows = 5; for (int i = 1; i <= rows; ++i) { for (int j = 1; j <= i; ++j) { System.out.print("* "); } System.out.println(); } }}

Similar questions