-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHollow_Rhombus_Pattern_17.java
More file actions
36 lines (32 loc) · 1015 Bytes
/
Hollow_Rhombus_Pattern_17.java
File metadata and controls
36 lines (32 loc) · 1015 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
import java.util.Scanner;
public class Hollow_Rhombus_Pattern_17 {
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int num=n;
int space=n-1;
for (int i = 1; i <= 2*n-1; i++) {
if (i % 2 == 0)
System.out.println();
else {
for (int j = 0; j < space; j++) {
System.out.print(" ");
}
if (i == 1 || i == 2 * n - 1) {
for (int j = 0; j < n; j++) {
System.out.print("*");
}
} else {
System.out.print("*");
for (int j = 0; j <n-2; j++) {
System.out.print(" ");
}
System.out.print("*");
}
space--;
System.out.println();
}
}
}
}