/* 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
*/
Subscribe to:
Post Comments (Atom)
3
36
365
3652