Advertisement
Venciity

[SoftUni C# exam preparation] 04.UK FLAG

Apr 9th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 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. class UKFlag
  8. {
  9.     static void Main()
  10.     {
  11.         int n = Int32.Parse(Console.ReadLine());
  12.         int height = n;
  13.         int width = n;
  14.  
  15.         int dotsBetween = n / 2 - 1;
  16.  
  17.         for (int i = 0; i < height / 2; i++)
  18.         {
  19.             string dotsBeforeAndAfter = new string('.', i);
  20.             string dotsBetweenSTtring = new string('.', dotsBetween);
  21.             Console.WriteLine("{0}\\{1}|{1}/{0}", dotsBeforeAndAfter, dotsBetweenSTtring);
  22.             dotsBetween = dotsBetween - 1;
  23.         }
  24.  
  25.         //middle
  26.         int dashes = width / 2;
  27.         string dasheshString = new string('-', dashes);
  28.         Console.WriteLine("{0}*{0}", dasheshString);
  29.  
  30.  
  31.         dotsBetween = dotsBetween + 1;
  32.         for (int i = height / 2 - 1; i >= 0; i--)
  33.         {
  34.             string dotsBeforeAndAfter = new string('.', i);
  35.             string dotsBetweenSTtring = new string('.', dotsBetween);
  36.             Console.WriteLine("{0}/{1}|{1}\\{0}", dotsBeforeAndAfter, dotsBetweenSTtring);
  37.             dotsBetween = dotsBetween + 1;
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement