Wed Aug 25 2021
Numeric Pyramid
Java Programming2016 views
File Name: numeric-pyramid.java
import java.io.*;
class pyramid {
public static void main(String args[ ]) {
int no, i, j;
/* Convert command line String argument into Integer */
no = Integer.parseInt(args[0]);
/* Loop the process */
for(i=0; i <= a; i++) {
/* Nested loop */
for(j=1; j <= i; j++)
System.out.print(i+" ");
System.out.println("");
}
}
}
/* Output */
java pyramid 5
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Author:Geekboots