Advertisement
KlimentHristov

Figure.StrippedTowel

Dec 2nd, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. class StrippedTowel
  3. {
  4.     static void Main()
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.  
  8.         int width = n;
  9.         int height = n + n / 2;
  10.  
  11.         for (int i = 0; i < height; i++)
  12.         {
  13.             for (int j = 0; j < width; j++)
  14.             {
  15.                 bool isStripe = (j + i) % 3 == 0;
  16.                 if (isStripe)
  17.                 {
  18.                     Console.Write("#");
  19.                 }
  20.                 else
  21.                 {
  22.                     Console.Write(".");
  23.                 }
  24.             }
  25.             Console.WriteLine();
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement