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:
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:
All Copyright © 2020 Are Reseved By Math Traders
No comments:
Post a Comment