PATTERN *1 23 456*

public class Pattern
{
public static void main(String[] args)
{
int i, j,s=1; // variable declaration
for(i= 1;i<=3;i++) // for 3 rows
{
for(j = 1;j<=i;j++) // for each row
{
System.out.print(s);
s++; // increment value of s by 1
}
System.out.println(); // new line
}

}

}


/*
OUTPUT:
1
23
456
*/

Comments

Popular Posts