Write a program to Print the follwing pattern
1
2 2
3 3 3
4 4 4 4


Code:
import java.io.*;
class pattrern1
{
public static void main()throws IOException
{
int i,j;int a=1;
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(read);
System.out.println("Enter the no. of rows");
int n=Integer.parseInt(in.readLine());
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
System.out.print(i);
a++;
System.out.println();


}
}
}