Saturday, November 1, 2014

Filled Under: , , ,

Number pattern 4 by do while loop

Share

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

  11111
  22222
  33333
  44444
  55555

*/

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

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


0 comments:

Post a Comment