Advertisement
Guest User

03.Programmer DNA

a guest
Apr 14th, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Numerics;
  6. using System.Threading.Tasks;
  7.  
  8. class ProgrammerDNA
  9. {
  10.     static void Main()
  11.     {
  12.         int n = int.Parse(Console.ReadLine());
  13.         char letter = char.Parse(Console.ReadLine());
  14.         char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G' };
  15.         int dots = 3;
  16.         int letterIndex = 0;
  17.         if(letter == 'A')
  18.         {
  19.             letterIndex = 0;
  20.         }
  21.         else if (letter == 'B')
  22.         {
  23.             letterIndex = 1;
  24.         }
  25.         else if (letter == 'C')
  26.         {
  27.             letterIndex = 2;
  28.         }
  29.         else if (letter == 'D')
  30.         {
  31.             letterIndex = 3;
  32.         }
  33.         else if (letter == 'E')
  34.         {
  35.             letterIndex = 4;
  36.         }
  37.         else if (letter == 'F')
  38.         {
  39.             letterIndex = 5;
  40.         }
  41.         else if (letter == 'G')
  42.         {
  43.             letterIndex = 6;
  44.         }
  45.         bool increasing = true;
  46.         for(int i = 0;i<n;i++)
  47.         {
  48.             Console.Write(new string('.', dots));
  49.             for (int p = 0; p < 7 - dots * 2;p++)
  50.             {
  51.                 Console.Write(letters[letterIndex]);
  52.                 if (letterIndex < 6)
  53.                 {
  54.                     letterIndex++;
  55.                 }
  56.                 else if (letterIndex == 6)
  57.                 {
  58.                     letterIndex = 0;
  59.                 }
  60.             }
  61.                 Console.Write(new string('.', dots));
  62.                 Console.WriteLine();
  63.             if(increasing && dots>0)
  64.             {
  65.                 dots--;
  66.             }
  67.             else if(increasing && dots==0)
  68.             {
  69.                 increasing = false;
  70.                 dots++;
  71.             }
  72.             else if(!increasing && dots<3)
  73.             {
  74.                 dots++;
  75.             }
  76.             else if(!increasing && dots == 3)
  77.             {
  78.                 increasing = true;
  79.             }
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement