-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkotakkosong.java
33 lines (32 loc) · 1.07 KB
/
kotakkosong.java
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
import java.util.Scanner;
public class kotakkosong{
public static void main(String[] args){
Scanner input = new Scanner (System.in);
System.out.print("Inputkan Jumlah Kolom : ");
int panjang = input.nextInt();
System.out.print("Inputkan Jumlah Baris : ");
int lebar = input.nextInt();
System.out.println("");
for (int i=1; i <= panjang ; i++){
if (i != 1 && i != panjang){
for (int j=1; j <= lebar ; j++){
if (j>1 && j< lebar)
{
System.out.print(" " + "\t");
}
else{
System.out.print("*" + "\t");
}
}
}
else
{
for (int x=1; x <= lebar ; x++)
{
System.out.print("*" + "\t");
}
}
System.out.println("");
}
}
}