
Write A program to Print Following In Java :
1
1 1 1
1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1

Here is a code that shows following pattern:
1
1 1 1
1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1
public class Pattern {
public static void main(String[] args) {
int N=6;
for(int i=1;i<=N;i++) {
for(int j=0;j<N-i;j++)System.out.print(" ");
for(int j=0;j<(2*i-1);j++) System.out.print("1");
System.out.println();
}
}
}