Skip to content

Instantly share code, notes, and snippets.

@vdonchev
Created June 6, 2015 13:00
Show Gist options
  • Save vdonchev/ca081e5277ea8effd75d to your computer and use it in GitHub Desktop.
Save vdonchev/ca081e5277ea8effd75d to your computer and use it in GitHub Desktop.
using System;
class TheExplorer
{
static void Main()
{
int length = int.Parse(Console.ReadLine());
int inner = 1;
int outter = length / 2;
for (int i = 0; i < length; i++)
{
string innerPart;
if (i == 0 || i == length - 1)
{
innerPart = new string('*', inner);
}
else
{
innerPart = "*" + new string('-', inner - 2) + "*";
}
Console.WriteLine("{0}{1}{0}", new string('-', outter), innerPart);
if (i < length / 2)
{
inner += 2;
outter--;
}
else
{
inner -= 2;
outter++;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment