Java Programming
Numeric Pyramid
Java programming example for numaric half pyramid with the help of for loop
By Geekboots
8/25/2021
0 views
numeric-pyramid.javaJava
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
Numeric half PyramidNumeric pyramidJava TutorialFor Loop