We can print the following Pattern
1)
* //Print *
* *
* * *
* * * *
2)
1 //Print J
1 2
1 2 3
1 2 3 4
3)
1 //print i
2 2
3 3 3
4 4 4 4
package demo;
import java.util.Scanner;
public class Pattern1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number");
int n=sc.nextInt();
for(int i=1;i=i;k--) {
System.out.print(" ");
}
for(int j=1;j<=i;j++) {
System.out.print("* ");
//System.out.print(j+ " ");
//System.out.print(i+ " ")
}
System.out.println();
}
}
}
O/P:-
Enter the number
5
1
1 2
1 2 3
1 2 3 4