Advertisement
dimipan80

Exam 6. Arrow

Jun 19th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.97 KB | None | 0 0
  1. namespace _3.Arrow
  2. {
  3.     using System;
  4.  
  5.     public class Arrow
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             checked
  10.             {
  11.                 int numN = int.Parse(Console.ReadLine());
  12.  
  13.                 int lenghtIntDotSeq = numN - 2;
  14.                 string internalDotSeq = new string('.', lenghtIntDotSeq);
  15.                 int lenghtExtDotSeq;
  16.                 string externalDotSeq;
  17.                 for (int row = 1; row < numN; row++)
  18.                 {
  19.                     lenghtExtDotSeq = numN / 2;
  20.                     externalDotSeq = new string('.', lenghtExtDotSeq);                    
  21.                     if (row == 1)
  22.                     {
  23.                         string topSeq = new string('#', numN);
  24.                         Console.WriteLine("{0}{1}{0}", externalDotSeq, topSeq);
  25.                     }
  26.                     else
  27.                     {
  28.                         Console.WriteLine("{0}#{1}#{0}", externalDotSeq, internalDotSeq);
  29.                     }
  30.                 }
  31.  
  32.                 string middleDsSeq = new string('#', (numN / 2) + 1);
  33.                 Console.WriteLine("{0}{1}{0}", middleDsSeq, internalDotSeq);
  34.  
  35.                 int maxLenghtRow = (numN * 2) - 1;
  36.                 for (int row = 1; row < numN; row++)
  37.                 {                    
  38.                     if (row == numN - 1)
  39.                     {
  40.                         externalDotSeq = new string('.', (numN / 2) * 2);
  41.                         Console.WriteLine("{0}#{0}", externalDotSeq);
  42.                     }
  43.                     else
  44.                     {
  45.                         externalDotSeq = new string('.', row);
  46.                         lenghtIntDotSeq = maxLenghtRow - (2 * row) - 2;
  47.                         internalDotSeq = new string('.', lenghtIntDotSeq);
  48.                         Console.WriteLine("{0}#{1}#{0}", externalDotSeq, internalDotSeq);
  49.                     }
  50.                 }
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement