CODE BOX
------------------------------------------------------------
/*program to print star pattern square box by do while loop
5
54
543
5432
54321
*/
class npat8do
{
public static void main(String a[])
{
int n,i,j;
n=Integer.parseInt(a[0]);
i=n;
do
{j=n;
do
{
System.out.print(j);
j--;
}
while(j>=i);
System.out.print("\n");
i--;
}
while(i>=1);
}
}
------------------------------------------------------------
/*program to print star pattern square box by do while loop
5
54
543
5432
54321
*/
class npat8do
{
public static void main(String a[])
{
int n,i,j;
n=Integer.parseInt(a[0]);
i=n;
do
{j=n;
do
{
System.out.print(j);
j--;
}
while(j>=i);
System.out.print("\n");
i--;
}
while(i>=1);
}
}
0 comments:
Post a Comment