Program to print Pyramid | Equilateral Number Triangle in Java - Math Traders

Latest

Program to print Pyramid | Equilateral Number Triangle in Java

 class NumberDemo{

public static void main(String[] args) {

int i, j, row=4;

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

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

System.out.print("  ");

}

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

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

}

System.out.println();

row--;

}

}

}


Output:

print Pyramid | Equilateral Number Triangle in Java


No comments:

Post a Comment