Thursday, October 30, 2014

Filled Under: ,

Number Pattern 8 by do while loop

Share
CODE BOX 
------------------------------------------------------------

/*program to print star pattern square box by do while loop

  5
  54
  543
  5432
  54321

*/

class npat8do
{
public static void main(String a[])
{
int n,i,j;
n=Integer.parseInt(a[0]);
i=n;
do
{j=n;
        do
        {
        System.out.print(j);
        j--;
 }
 while(j>=i);
System.out.print("\n");
i--;
}
while(i>=1); 

}
}


0 comments:

Post a Comment