Thursday, October 30, 2014

Filled Under: , ,

Number Pattern 8 by while loop

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

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

  5
  54
  543
  5432
  54321

*/

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

System.out.print("\n");
i--;
}
}
}


0 comments:

Post a Comment