-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern7
More file actions
29 lines (26 loc) · 696 Bytes
/
Copy pathpattern7
File metadata and controls
29 lines (26 loc) · 696 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
29
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();
nForest7(n);
// nForest2(n);
}
}
public static void nForest7(int n){
for(int i=0;i<n;i++){
for(int j=0;j<n-i-1;j++){
System.out.print(" ");
}
for(int k=0;k<(2*i+1);k++){
System.out.print("*");
}
for(int j=0;j<n-i-1;j++){
System.out.print(" ");
}
System.out.println();
}
}
}