Advertisement
rado8506

05. Parallelepiped

Feb 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp38
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int waves = n - 2;
  15.             int upperDots = 2 * n + 1;
  16.             Console.WriteLine("+{0}+{1}", new string('~', waves), new string('.', upperDots));
  17.  
  18.             int rightDots = 2 * n;
  19.             for (int i = 0; i < (2 * n) + 1; i++)
  20.             {
  21.                 int leftDots = i;
  22.                 Console.WriteLine("|{0}\\{1}\\{2}", new string('.', leftDots), new string('~', waves), new string('.', rightDots));
  23.                 rightDots--;
  24.             }
  25.             int lowerRightDots = 2 * n;
  26.             for (int i = 0; i < (2 * n) + 1; i++)
  27.             {
  28.                 int lowerLeftDots = i;
  29.                 Console.WriteLine("{0}\\{1}|{2}|", new string('.', lowerLeftDots), new string('.', lowerRightDots), new string('~', waves));
  30.                 lowerRightDots--;
  31.             }
  32.             Console.WriteLine("{0}+{1}+", new string('.', upperDots), new string('~', waves));
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement