Output:
Code:
-----------------------------------------------
class Kotak_X {
public static void main(String args[])
{
int N, J, I, kiri, kanan;
N = 11;
J = 0;
I = 0;
kiri = 0;
kanan = N - 1;
while(I < N)
{
while(J < N)
{
if(J == 0 || J == N - 1)
System.out.print("*");
else
{
if(I == 0 || I == N - 1)
{
System.out.print("*");
}
else
{
if(J == kiri || J == kanan)
System.out.print("*");
else
System.out.print(" ");
}
}
J++;
}
J = 0;
System.out.println();
I++;
kiri++;
kanan--;
}
}
}
-------------------------------------------------------
Download contoh.
Keep Lerning!!
Subscribe to:
Post Comments (Atom)
1 comments:
trah mantabs...
Post a Comment