Pyramid Of Numbers

1 comments - Post a comment

/* Simple Program In java to Print the Following Pyramid
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9
*/

class PyramidNos
{
public static void main(String args[])
{
int i,j;
System.out.println("Displaying Numbers:");
for(i=1;i< 10;i++)
{
for(j=1;j< i+1;j++)
{
System.out.print(" " +i);
}
System.out.println();
}
}
}

/* OUTPUT *

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9
*/

 
This Post has 1 Comment Add your own!
ani - August 13, 2012 at 9:17 PM

3
36
365
3652

Post a Comment