codingan nya ya.
int row;
int row2;
int col;
int col2;
int spasi;
int akhir;
Console.Write("Masukan
nilai akhir ");
akhir = Convert.ToInt32(Console.ReadLine());
row2 = 0;
for (row = akhir; row >= 1; row--)
{
for (col = row; col >= 1; col--)
{
Console.Write("%");
}
for (spasi = 0; spasi <= row2;
spasi++)
{
if (spasi != 0)
{
Console.Write(" ");
}
}
for (col2 = row; col2 >= 1; col2--)
{
Console.Write("%");
}
Console.WriteLine("");
row2 = row2 + 2;
}
row2 = row2 - 4;
for (row = 2; row <= akhir; row++)
{
for (col = 1; col <= row; col++)
{
Console.Write("%");
}
for (spasi = row2; spasi >= 0;
spasi--)
{
if (spasi != 0)
{
Console.Write(" ");
}
}
for (col = 1; col <= row; col++)
{
Console.Write("%");
}
Console.WriteLine("");
row2 = row2 - 2;
}
Console.ReadLine();
Sudah paham belum ? Jika belum paham, Komentar aja ya.
Mungkin hanya segitu aja yang bisa saya share, nantikan update an terbarunya pada blog ini.
0 komentar:
Post a Comment