---------------------------------
/*program to print number pattern by do while loop
1
12
123
1234
12345
*/
class npat2do
{
public static void main(String a[])
{
int n,i,j;
i=1;
n=Integer.parseInt(a[0]);
do
{j=1;
do
{
System.out.print(j);
j++;
}
while(j<=i);
System.out.print("\n");
i++;
}
while(i<=n);
}
}
0 comments:
Post a Comment