Saturday, November 1, 2014

Filled Under: , , ,

Number Pattern 6 by do while loop

Share

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

  55555
  44444
  33333
  22222
  11111
  

*/

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

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


0 comments:

Post a Comment