Translate

Wednesday 4 July 2012

Write java code to print following pattern:

1
12
123
1234
12345
123456
1234567
12345678
123456789

Solution:

class Pattern1
{
public static void main(String args[])
{
for(int i=1;i<10;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}
}
}

No comments:

Post a Comment