Created
January 21, 2024 15:10
Bat Goiko Tower
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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