-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar5_3.java
More file actions
44 lines (39 loc) Β· 940 Bytes
/
Star5_3.java
File metadata and controls
44 lines (39 loc) Β· 940 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
43
44
package basic.star;
import java.util.Scanner;
/*
*
* *
*****
*/
public class Star5_3 implements StarInterface{
public static Scanner scan = new Scanner(System.in);
@Override
public void StarPrint() {
int size = scan.nextInt();
int star=1;
int brank = size-1;
int brank2=1;
for(int i= 0; i< brank;i++){
System.out.print(" ");
}
System.out.println("*");
star+=2;
brank--;
for(int i = 0 ; i <size-2;i++){
for(int j = 0; j<brank;j++){
System.out.print(" ");
}
System.out.print("*");
for(int j = 0;j<brank2;j++){
System.out.print(" ");
}
System.out.println("*");
star+=2;
brank--;
brank2+=2;
}
for(int i = 0 ; i<star;i++){
System.out.print("*");
}
}
}