Numeric Pyramid

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

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!