Advertisement
Filkolev

Panda Scotland Flag

Jul 25th, 2014
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 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.  
  8. class PandaScotlandFlag
  9. {
  10.     static void Main()
  11.     {
  12.         int N = int.Parse(Console.ReadLine());
  13.  
  14.         //char[] letters = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'}
  15.  
  16.         // 65-90
  17.  
  18.         int currentLetter = 65;
  19.  
  20.         for (int i = 0; i < N/2; i++)
  21.         {
  22.             if (currentLetter == 91)
  23.             {
  24.                 currentLetter = 65;
  25.             }
  26.  
  27.             char ch1 = (char)currentLetter;
  28.             char ch2 = (char)(currentLetter + 1);
  29.  
  30.             if (currentLetter + 1 == 91)
  31.             {
  32.                 ch2 = (char)65;
  33.                 currentLetter = 64;
  34.             }
  35.  
  36.             currentLetter += 2;
  37.  
  38.             Console.WriteLine("{0}{1}{2}{3}{0}", new string('~', i), ch1, new string('#', N - 2 - 2*i), ch2);
  39.         }
  40.  
  41.         Console.WriteLine("{0}{1}{0}", new string('-', N/2), (char)currentLetter);
  42.         currentLetter++;
  43.  
  44.         for (int i = 0; i < N/2; i++)
  45.         {
  46.            if (currentLetter == 91)
  47.             {
  48.                 currentLetter = 65;
  49.             }
  50.  
  51.             char ch1 = (char)currentLetter;
  52.             char ch2 = (char)(currentLetter + 1);
  53.  
  54.             if (currentLetter + 1 == 91)
  55.             {
  56.                 ch2 = (char)65;
  57.                 currentLetter = 64;
  58.             }
  59.  
  60.             currentLetter += 2;
  61.  
  62.             Console.WriteLine("{0}{1}{2}{3}{0}", new string('~', (N - 3 - 2*i)/2), ch1, new string('#', 2*i + 1), ch2);
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement