Program to print invert triangle in java | Number pattern in java - Math Traders

Latest

Program to print invert triangle in java | Number pattern in java

 class NumberDemo{

public static void main(String[] args) {

int i, j, row=5;

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

for (j=1; j<=row ; j++ ) {

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

}

System.out.println();

row--;

}

}

}


Output:

1 2 3 4 5

1 2 3 4

1 2 3

1 2

1

print invert triangle in java | Number pattern


No comments:

Post a Comment