Skip to content

Instantly share code, notes, and snippets.

@Nanich87
Created January 21, 2024 15:10
Bat Goiko Tower
using System;
namespace TelerikExamples
{
class BatGoikoTower
{
static void Main()
{
int towerHeight = int.Parse(Console.ReadLine());
int currentDashIndex = 1;
int nextDashIndex = 3;
for (int i = 0; i < towerHeight; i++)
{
Console.Write(new string('.', towerHeight - i - 1));
Console.Write("/");
if (currentDashIndex == i)
{
Console.Write(new string('-', 2 * i));
currentDashIndex = nextDashIndex;
nextDashIndex = 2 * currentDashIndex - i + 1;
}
else
{
Console.Write(new string('.', 2 * i));
}
Console.Write("\\");
Console.Write(new string('.', towerHeight - i - 1));
Console.WriteLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment