Sunday, 23 September 2012

Java Program For Pyramid Of Numbers 2

Pyramid Sequence
5
5 6
5 6 7
5 6 7 8


class Pyramid2
{
public static void main(String args[])
{
int i,j;
for(i=5;i<=8;i++)
{
for(j=5;j<=i;j++)
System.out.print(" "+j);
System.out.print("\n");
}
}
}

/********* OUTPUT ********
5
5 6
5 6 7
5 6 7 8 */

0 comments:

Post a Comment