Sunday, September 22, 2013

Filled Under: , , , , ,

Number Pattern 3 by for loop

Share


Code Box by for loop
-----------------------------
/*program to print number pattern by for loop

  1
  22
  333
  4444
  55555

*/

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

n=Integer.parseInt(a[0]);

for(i=1;i<=n;i++)
{
        for(j=1;j<=i;j++)
        {
        System.out.print(i);
        }

System.out.print("\n");

}
}
}



0 comments:

Post a Comment