Saturday, November 1, 2014

Filled Under: , ,

Number Pattern 5 by do while loop

Share

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

  54321
  54321
  54321
  54321
  54321
  

*/

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

do
{j=n;
        do
        {
        System.out.print(j);
        j--;
}
while(j>=1);

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


0 comments:

Post a Comment