svetlozar_kirkov

Panda Scotland Flag

Sep 11th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ScotlandPandaFlag
  4. {
  5.     class ScotlandPandaFlag
  6.     {
  7.         static void Main()
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             char temp = (char)65;
  11.             int j = 1;
  12.  
  13.             for (int i = 0; i < n; i++)
  14.             {
  15.                 if (i == n/2)
  16.                 {
  17.                     Console.Write(new string('-', n / 2));
  18.                     if (temp == (char)91)
  19.                     {
  20.                         temp = (char)65;
  21.                     }
  22.                     Console.Write(new string((char)temp, 1));
  23.                     Console.Write(new string('-', n / 2));
  24.                     Console.WriteLine();
  25.  
  26.                     if (temp == (char)91)
  27.                     {
  28.                         temp = (char)65;
  29.                     }
  30.                     else
  31.                     {
  32.                         temp++;
  33.                     }
  34.                 }
  35.                 else if (i < n / 2 && i > 0 )
  36.                 {
  37.                     Console.Write(new string('~', j));
  38.  
  39.                     if (temp == (char)91)
  40.                     {
  41.                         temp = (char)65;
  42.                     }
  43.  
  44.                     Console.Write(new string((char)temp, 1));
  45.                     Console.Write(new string('#', n - 2*j-2));
  46.  
  47.                     if (temp == (char)91)
  48.                     {
  49.                         temp = (char)65;
  50.                     }
  51.                     else
  52.                     {
  53.                         temp++;
  54.                     }
  55.                    
  56.                     Console.Write(new string((char)temp, 1));
  57.                     Console.Write(new string('~', j));
  58.                     Console.WriteLine();
  59.  
  60.                     if (temp == (char)91)
  61.                     {
  62.                         temp = (char)65;
  63.                     }
  64.                     else
  65.                     {
  66.                         temp++;
  67.                     }
  68.  
  69.                     j++;
  70.                 }
  71.                 else if (i > n / 2 && i > 0)
  72.                 {
  73.                     j--;
  74.                     Console.Write(new string('~', j));
  75.  
  76.                     if (temp == (char)91)
  77.                     {
  78.                         temp = (char)65;
  79.                     }
  80.  
  81.                     Console.Write(new string((char)temp, 1));
  82.  
  83.                     if (temp == (char)91)
  84.                     {
  85.                         temp = (char)65;
  86.                     }
  87.                     else
  88.                     {
  89.                         temp++;
  90.                     }
  91.  
  92.                     Console.Write(new string('#', n - 2*j-2));
  93.  
  94.                     if (temp == (char)91)
  95.                     {
  96.                         temp = (char)65;
  97.                     }
  98.                    
  99.  
  100.                     Console.Write(new string((char)temp, 1));
  101.                     Console.Write(new string('~', j));
  102.                     Console.WriteLine();
  103.  
  104.                     if (temp == (char)91)
  105.                     {
  106.                         temp = (char)65;
  107.                     }
  108.                     else
  109.                     {
  110.                         temp++;
  111.                     }
  112.  
  113.                 }
  114.                 else if (i == 0)
  115.                 {
  116.                     if (temp == (char)91)
  117.                     {
  118.                         temp = (char)65;
  119.                     }
  120.  
  121.                     Console.Write(new string((char)temp, 1));
  122.                     Console.Write(new string('#', n - 2));
  123.  
  124.                     if (temp == (char)91)
  125.                     {
  126.                         temp = (char)65;
  127.                     }
  128.                     else
  129.                     {
  130.                         temp++;
  131.                     }
  132.  
  133.                     Console.Write(new string((char)temp, 1));
  134.                     Console.WriteLine();
  135.  
  136.                     if (temp == (char)91)
  137.                     {
  138.                         temp = (char)65;
  139.                     }
  140.                     else
  141.                     {
  142.                         temp++;
  143.                     }
  144.  
  145.                 }
  146.                
  147.             }
  148.         }
  149.     }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment