-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern8
More file actions
28 lines (26 loc) · 684 Bytes
/
Copy pathpattern8
File metadata and controls
28 lines (26 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.*;
public class patterns{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int n=sc.nextInt();
nForest8(n);
// nForest2(n);
}
}
public static void nForest8(int n){
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
System.out.print(" ");
}
for(int k=0;k<(2n)-(2*i+1);k++){
System.out.print("*");
}
for(int j=0;j<i;j++){
System.out.print(" ");
}
System.out.println();
}
}
}