BorislavBorisov

37.02.UK Flag мое решение добро new string

Oct 25th, 2015
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.45 KB | None | 0 0
  1. using System;
  2. class UKFlag
  3. {
  4.     static void Main()
  5.     {
  6.         int N = int.Parse(Console.ReadLine());
  7.         int middleDdots = N / 2 - 1;
  8.         int outDots = 1;
  9.  
  10.         for (int row = 0; row < N; row++)
  11.         {
  12.             if (row == 0)
  13.             {
  14.                 Console.Write("\\");
  15.                 Console.Write(new string('.', middleDdots));
  16.                 Console.Write("|");
  17.                 Console.Write(new string('.', middleDdots));
  18.                 Console.Write("/");
  19.                 Console.WriteLine();
  20.                 middleDdots--;
  21.             }
  22.             else if(row < N / 2)
  23.             {
  24.                 Console.Write(new string('.', outDots));
  25.                 Console.Write("\\");
  26.                 Console.Write(new string('.', middleDdots));
  27.                 Console.Write("|");
  28.                 Console.Write(new string('.', middleDdots));
  29.                 Console.Write("/");
  30.                 Console.Write(new string('.', outDots));
  31.                 Console.WriteLine();
  32.                 middleDdots--;
  33.                 outDots++;
  34.             }
  35.             else if (row == N / 2)
  36.             {
  37.                 Console.Write(new string('-', N / 2));
  38.                 Console.Write("*");
  39.                 Console.Write(new string('-', N / 2));
  40.                 Console.WriteLine();
  41.                 outDots--;
  42.                 middleDdots++;
  43.             }
  44.             else
  45.             {
  46.                 if (row == N / 2 + 1)
  47.                 {
  48.                     Console.Write(new string('.', outDots));
  49.                     Console.Write("/");
  50.                     Console.Write("|");
  51.                     Console.Write("\\");
  52.                     Console.Write(new string('.', outDots));
  53.                     Console.WriteLine();
  54.                     outDots--;
  55.                     middleDdots++;
  56.                    
  57.                 }
  58.                 else
  59.                 {
  60.                     Console.Write(new string('.', outDots));
  61.                     Console.Write("/");
  62.                     Console.Write(new string('.', middleDdots));
  63.                     Console.Write("|");
  64.                     Console.Write(new string('.', middleDdots));
  65.                     Console.Write("\\");
  66.                     Console.Write(new string('.', outDots));
  67.                     outDots--;
  68.                     middleDdots++;
  69.                     Console.WriteLine();
  70.                 }
  71.             }
  72.            
  73.         }
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment