Advertisement
fbinnzhivko

03.00 Plaid Towel

Mar 16th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using System;
  2. class Program
  3. {
  4.     static void Main()
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.         char background = char.Parse(Console.ReadLine());
  8.         char rhombus = char.Parse(Console.ReadLine());
  9.  
  10.         for (int i = 0; i < 2; i++)
  11.         {
  12.             Console.WriteLine("{0}{1}{2}{1}{0}", new string(background, n), rhombus, new string(background, n * 2 - 1));
  13.             int outter = n - 1; // left and right background symbols
  14.             int middle = n * 2 - 3; // background symbols between two rhombus
  15.             int inner = 1; // background symbols inside rhombus
  16.             for (int j = 0; j < n - 1; j++)
  17.             {
  18.                 Console.WriteLine("{0}{1}{2}{1}{3}{1}{2}{1}{0}",
  19.                     new string(background, outter), rhombus, new string(background, inner),
  20.                     new string(background, middle));
  21.  
  22.                 outter--;
  23.                 inner += 2;
  24.                 middle -= 2;
  25.             }
  26.             Console.WriteLine("{0}{1}{0}{1}{0}", rhombus, new string(background, inner));
  27.  
  28.             for (int j = 0; j < n - 1; j++)
  29.             {
  30.                 outter++;
  31.                 inner -= 2;
  32.                 middle += 2;
  33.                 Console.WriteLine("{0}{1}{2}{1}{3}{1}{2}{1}{0}", new string(background, outter),
  34.                     rhombus, new string(background, inner), new string(background, middle));
  35.             }
  36.  
  37.         }
  38.       Console.WriteLine("{0}{1}{2}{1}{0}", new string(background, n), rhombus, new string(background, n * 2 - 1));
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement