Saturday, November 1, 2014

Filled Under: , , ,

Number Pattern 6 by while loop

Share

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

  55555
  44444
  33333
  22222
  11111
  

*/

class npat6w
{
public static void main(String a[])
{
int n,i,j;

n=Integer.parseInt(a[0]);
i=n;
while(i>=1)
{j=1;
        while(j<=n)
        {
        System.out.print(i);
        j++;
}

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


0 comments:

Post a Comment