-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesign2.java
More file actions
41 lines (35 loc) · 901 Bytes
/
Copy pathdesign2.java
File metadata and controls
41 lines (35 loc) · 901 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
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.*;
class design2{
public static void main(String[] args) {
int n=new Scanner(System.in).nextInt();
System.out.println("Number="+n);
for (int k=n;k>0 ;k-- ){
for(int i=1;i<k;i++){ //upper half, quadrant IV
System.out.print("--");
}
for (int j=n;j>k-1 ;j-- ) {
System.out.print("-"+j);
}
for(int j=k+1;j<=n;j++){ //upper half, quadrant I
System.out.print("-"+j);
}
for(int i=1;i<k;i++)
System.out.print("--"); //mid half end
System.out.println() ;
}
for (int k=1;k<n ;k++ ) {
for(int i=1;i<=k;i++){ //Lower half , Quadrant III
System.out.print("--");
}
for (int j=n;j>k ;j-- ) {
System.out.print("-"+j);
}
for(int j=k+2;j<=n;j++){ //Lower half, Quadrant II
System.out.print("-"+j);
}
for(int i=1;i<=k;i++)
System.out.print("--");
System.out.println();
} //Lower Half Ends
}
}