class pattern_1
{
public void main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(j+” “);
}
System.out.println();
}
}
}
The pattern is printed according to the above logic .
The i-loop is used for the rows .
The j-loop is used for the columns .
The statement “println” helps to print the line gap .
The statement “print” has no such gap .
The printing is done by the j-loop and after the ‘j’ gets printed , I have added a space so that the program looks nice .