Skip to content

Commit 3a9aad9

Browse files
Pattern 23
W pattern
1 parent f7acafa commit 3a9aad9

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) {
6+
Scanner scn = new Scanner(System.in);
7+
8+
int n=scn.nextInt();
9+
for(int i=1;i<=n;i++){
10+
for(int j=1;j<=n;j++){
11+
12+
if(j==1 ||j==n){
13+
System.out.print("* ");
14+
}else if(i>n/2 && ((i+j==n+1) ||(i==j))){
15+
System.out.print("* ");
16+
}else{
17+
System.out.print(" ");
18+
}
19+
}
20+
System.out.println();
21+
} // write ur code here
22+
23+
}
24+
}

0 commit comments

Comments
 (0)