-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStar9.java
More file actions
35 lines (26 loc) Β· 886 Bytes
/
Star9.java
File metadata and controls
35 lines (26 loc) Β· 886 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
package basic.star;
import java.util.Scanner;
public class Star9 implements StarInterface{
static Scanner scan = new Scanner(System.in);
@Override
public void StarPrint() {
int size = scan.nextInt();
int w = scan.nextInt();
int h = scan.nextInt();
int width = size*w+2*(w-1);
int heigh = size*h+2*(h-1);
// 0 1 2 3 4 012λ μΆλ ₯ 3 4λ λΈλν¬
// sizeλ 3
int onec = size+2;
for(int i=0;i<heigh;i++){
if(i%(onec)==size||i%(onec)==size+1) System.out.println("X");
else{
for(int j = 0 ; j <width;j++){
if((j%(onec)>=0)&&(j%(onec)<=size-1)&&(i%(onec)==0||i%(onec)==size-1))System.out.print("O");
else System.out.print("X");
}
System.out.println();
}
}
}
}