Advertisement
vkv1986

Carpets

Jan 9th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.03 KB | None | 0 0
  1. using System;
  2.  
  3. class Carpets
  4. {
  5.     static void Main()
  6.     {
  7.         int size = int.Parse(Console.ReadLine());
  8.         for (int row = 0; row < size / 2; row++)
  9.         {
  10.             if (row % 2 == 0)
  11.             {
  12.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  13.                 {
  14.                     Console.Write(".");
  15.                 }
  16.                 for (int column = 0; column < row / 2; column++)
  17.                 {
  18.                     Console.Write("/ ");
  19.                 }
  20.                 Console.Write("/\\");
  21.                 for (int column = 0; column < row / 2; column++)
  22.                 {
  23.                     Console.Write(" \\");
  24.                 }
  25.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  26.                 {
  27.                     Console.Write(".");
  28.                 }
  29.             }
  30.             else
  31.             {
  32.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  33.                 {
  34.                     Console.Write(".");
  35.                 }
  36.                 for (int column = 0; column < (row + 1) / 2; column++)
  37.                 {
  38.                     Console.Write("/ ");
  39.                 }
  40.                 for (int column = 0; column < (row + 1) / 2; column++)
  41.                 {
  42.                     Console.Write(" \\");
  43.                 }
  44.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  45.                 {
  46.                     Console.Write(".");
  47.                 }
  48.             }
  49.             Console.WriteLine();
  50.         }
  51.         for (int row = size / 2 - 1; row >= 0; row--)
  52.         {
  53.             if (row % 2 == 0)
  54.             {
  55.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  56.                 {
  57.                     Console.Write(".");
  58.                 }
  59.                 for (int column = 0; column < row / 2; column++)
  60.                 {
  61.                     Console.Write("\\ ");
  62.                 }
  63.                 Console.Write("\\/");
  64.                 for (int column = 0; column < row / 2; column++)
  65.                 {
  66.                     Console.Write(" /");
  67.                 }
  68.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  69.                 {
  70.                     Console.Write(".");
  71.                 }
  72.             }
  73.             else
  74.             {
  75.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  76.                 {
  77.                     Console.Write(".");
  78.                 }
  79.                 for (int column = 0; column < (row + 1) / 2; column++)
  80.                 {
  81.                     Console.Write("\\ ");
  82.                 }
  83.                 for (int column = 0; column < (row + 1) / 2; column++)
  84.                 {
  85.                     Console.Write(" /");
  86.                 }
  87.                 for (int column = 0; column < (size / 2) - row - 1; column++)
  88.                 {
  89.                     Console.Write(".");
  90.                 }
  91.             }
  92.             Console.WriteLine();
  93.         }
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement