Saturday, November 1, 2014

Filled Under: , , , ,

Number Pattern 4 by while loop

Share

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

  11111
  22222
  33333
  44444
  55555

*/

class npat4w
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);

while(i<=n)
{j=1;
        while(j<=n)
        {
        System.out.print(i);
        j++;
}

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

}
}

0 comments:

Post a Comment