Advertisement
silvi81

Striped Towel

Dec 1st, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 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 Exam30August2015
  8. {
  9.     class StripedTowel
  10.     {
  11.         static void Main()
  12.         {
  13.             int width = int.Parse(Console.ReadLine());
  14.             double height= Math.Floor(width * 1.5);
  15.             string symbol = "";
  16.             int counter = 1;
  17.  
  18.             for (int i = 0; i < height; i++)
  19.             {
  20.                 for (int j = 0; j < width; j++)
  21.                 {
  22.                     if (counter==1)
  23.                     {
  24.                         symbol = "#..";
  25.                     }
  26.                     else if (counter == 2)
  27.                     {
  28.                         symbol = "..#";
  29.                     }
  30.                     else
  31.                     {
  32.                         symbol = ".#.";
  33.                     }
  34.  
  35.                     if (j==0)
  36.                     {
  37.                         Console.Write(symbol[j]);
  38.                     }
  39.                     else
  40.                     {
  41.                         Console.Write(symbol[j % symbol.Length]);
  42.                     }
  43.                 }
  44.                 counter++;
  45.                 if (counter>3)
  46.                 {
  47.                     counter = 1;
  48.                 }
  49.                 Console.WriteLine();
  50.  
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement