-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar5_2.java
More file actions
34 lines (31 loc) Β· 729 Bytes
/
Star5_2.java
File metadata and controls
34 lines (31 loc) Β· 729 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
package basic.star;
import java.util.Scanner;
/*
*
***
*****
*******
*/
public class Star5_2 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;
for(int i = 0 ; i <size;i++){
for(int j = 0; j<brank;j++){
System.out.print(" ");
}
for(int j =0 ;j<star;j++){
System.out.print("*");
}
for(int j = 0; j<brank;j++){
System.out.print(" ");
}
System.out.println();
star+=2;
brank--;
}
}
}