fbinnzhivko

03.03 Plaid Towel

Mar 16th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.48 KB | None | 0 0
  1. using System;
  2. namespace PlaidTowel
  3. {
  4.     class Program
  5.     {
  6.         static void PrintColumns(int columns, int size, int row, string rhombusStr, string backgroundStr)
  7.         {
  8.             for (int col = 0; col < columns; col++)
  9.             {
  10.                 if (col == size - row || col == (size * 3) - row
  11.                     || col == size + row || col == (size * 3) + row)
  12.                 {Console.Write(rhombusStr);}
  13.                 else
  14.                 {Console.Write(backgroundStr);}
  15.             }
  16.             Console.WriteLine();
  17.         }
  18.  
  19.         static void Main()
  20.         {
  21.             int number = int.Parse(Console.ReadLine());
  22.             string backgroundSymbol = Console.ReadLine();
  23.             string rhombusSymbol = Console.ReadLine();
  24.             int width = 4 * number + 1;
  25.             for (int row = 0; row <= number; row++)
  26.             {
  27.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  28.             }
  29.             for (int row = number - 1; row > 0; row--)
  30.             {
  31.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  32.             }
  33.             for (int row = 0; row <= number; row++)
  34.             {
  35.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  36.             }
  37.             for (int row = number - 1; row >= 0; row--)
  38.             {
  39.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  40.             }
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment