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