Sunday, 23 September 2012

Java Program For Pyramid Of Numbers

Pyramid Sequence

4
4 3
4 3 2
4 3 2 1


class Pyramid3
{
public static void main(String args[])
{
int i,j;
for(i=4;i>=1;i--)
{
for(j=4;j>=i;j--)
System.out.print(" "+j);
System.out.print("\n");
}
}
}

/********* OUTPUT ********
4
4 3
4 3 2
4 3 2 1 */

0 comments:

Post a Comment