Wednesday, 27 July 2011

Simple program for making Pyramid using only while loop


1
1 2
1 2 3
1 2 3 4
1 2 3 4…..N

class series
{

Public static void main (String args [])

{

int N=10; i=1; j=1;
while( i<N)

{

j=1;
while(J<=i)

{

System.out.println(j);
J++;

}

System.out.println(“”);
i++;

}
}
}








0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More