Advertisement
Guest User

PlaidTowel

a guest
Oct 18th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.69 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 PlaidTowel
  8. {
  9.     class Program
  10.     {
  11.         static void PrintColumns(int columns, int size, int row, string rhombusStr, string backgroundStr)
  12.         {
  13.             for (int col = 0; col < columns; col++)
  14.             {
  15.                 if (col == size - row || col == (size * 3) - row
  16.                     || col == size + row || col == (size * 3) + row)
  17.                 {
  18.                     Console.Write(rhombusStr);
  19.                 }
  20.                 else
  21.                 {
  22.                     Console.Write(backgroundStr);
  23.                 }
  24.             }
  25.             Console.WriteLine();
  26.         }
  27.    
  28.         static void Main(string[] args)
  29.         {
  30.             int number = int.Parse(Console.ReadLine());
  31.             string backgroundSymbol = Console.ReadLine();
  32.             string rhombusSymbol = Console.ReadLine();
  33.             int width = 4 * number + 1;            
  34.             for (int row = 0; row <= number; row++)
  35.             {
  36.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  37.             }
  38.             for (int row = number - 1; row > 0; row--)
  39.             {
  40.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  41.             }
  42.             for (int row = 0; row <= number; row++)
  43.             {
  44.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  45.             }
  46.             for (int row = number - 1; row >= 0; row--)
  47.             {
  48.                 PrintColumns(width, number, row, rhombusSymbol, backgroundSymbol);
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement