Skip to content

Instantly share code, notes, and snippets.

@sguzunov
Created March 7, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sguzunov/4032cdeaaa66e6dfbed3e6d28d04454b to your computer and use it in GitHub Desktop.
Save sguzunov/4032cdeaaa66e6dfbed3e6d28d04454b to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Paralelepiped
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
int width = (3 * n) + 1;
int height = (4 * n) + 4;
// Draw top
string topRow = "+" + RepeatSymbol('~', n - 2) + "+" + RepeatSymbol('.', width - n);
Console.WriteLine(topRow);
for (int i = 0; i < (height / 2) - 1; i++)
{
string row = "|";
row += RepeatSymbol('.', i);
row += "\\";
row += RepeatSymbol('~', n - 2);
row += "\\";
row += RepeatSymbol('.', width - (n + i + 1));
Console.WriteLine(row);
}
// Draw bottom
for (int i = 0; i < (height / 2) - 1; i++)
{
string row = RepeatSymbol('.', i);
row += "\\";
row += RepeatSymbol('.', width - (n + i + 1));
row += "|";
row += RepeatSymbol('~', n - 2);
row += "|";
Console.WriteLine(row);
}
string bottomRow = RepeatSymbol('.', width - n) + "+" + RepeatSymbol('~', n - 2) + "+";
Console.WriteLine(bottomRow);
}
static string RepeatSymbol(char symbol, int count)
{
string result = "";
for (int i = 0; i < count; i++)
{
result += symbol;
}
return result;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment