1
23
456
Solution:
class printPattern
{
public static void main(String abc[])
{
int counter=1;
for(int i=1;i<4;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(counter);
counter++;
}
System.out.println();
}
}
}
23
456
Solution:
class printPattern
{
public static void main(String abc[])
{
int counter=1;
for(int i=1;i<4;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(counter);
counter++;
}
System.out.println();
}
}
}
No comments:
Post a Comment