//bentuk L
for (int i = 1; i < 6; i++) {
for (int j =
1; j < 6; j++) {
if (j ==
1 || i == 5){
System.out.print(" *");
} else {
System.out.print("");
}
}
System.out.println("");}}}
//bentuk kotak penuh
for (int i = 1;i<=5 ; i ++){ // "@\"
for
(int j=1; j<=5;j++)
if (i==j || j==6)
System.out.print("@");
else
System.out.print("*");
System.out.print("\n");}}}
//bentuk plus
for (int i = 1;i<=5 ; i ++){ //+
for
(int j=1; j<=5;j++)
if (i==3 || j==5 )
System.out.print("^ ");
else
System.out.print(" ");
System.out.print("\n");}}}
//bentuk silang
for (int i = 1;i<=5 ; i ++){ //X
for
(int j=1; j<=5;j++)
if (i==j || i+j==6 )
System.out.print("*");
else
System.out.print(" ");
System.out.print("\n");}}}
//bentuk kotak tenganhnya bolong
for (int i =
1;i<=5 ; i ++){ //kotak
for
(int j=1; j<=5;j++)
if (i==1 || i==5 ||j==1||j==5)
System.out.print("*");
else
System.out.print(" ");
System.out.print("\n");}}}
##SELAMAT MENCOBA##
0 komentar:
Posting Komentar