-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesign.java
More file actions
42 lines (39 loc) · 864 Bytes
/
Copy pathdesign.java
File metadata and controls
42 lines (39 loc) · 864 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
42
import java.util.*;
class design{
public static void main(String[] args) {
int n=new Scanner(System.in).nextInt();
System.out.println("Number="+n);
/* for(int i=64+n;i>64;i--){
System.out.println((char)i);
}
*/ for (int k=n;k>0 ;k-- ) {
for(int i=1;i<k;i++){ //upper half
System.out.print(" ");
}
for (int j=n;j>k-1 ;j-- ) {
System.out.print(j);
}
//for(int i=1;i<n;i++){
for(int j=k+1;j<=n;j++){
System.out.print(j);
}
System.out.println(); //mid half end
}
for (int k=1;k<n ;k++ ) {
//System.out.print(" ");
for(int i=1;i<=k;i++){ //upper half
System.out.print(" ");
}
for (int j=n;j>k ;j-- ) {
System.out.print(j);
}
for(int j=k+2;j<=n;j++){
System.out.print(j);
}
System.out.println(" ");
//for(int i=1;i<k;i++){ //upper half
// System.out.print("-");
// }
}
}
}