Advertisement
reathh

03.Arrow

Apr 24th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 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. namespace Arrow
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int width = int.Parse(Console.ReadLine());
  14.  
  15.  
  16.             PrintUpper(width);
  17.  
  18.         }
  19.  
  20.  
  21.         static void PrintUpper(int n)
  22.         {
  23.             Console.Write(new string('.', (n - 1) / 2));
  24.             Console.Write(new string('#', n));
  25.             Console.WriteLine(new string('.', (n - 1) / 2));
  26.             PrintMiddle(n);
  27.         }
  28.  
  29.  
  30.  
  31.         static void PrintMiddle(int n)
  32.         {
  33.  
  34.             for (int i = 1; i <= n - 2; i++)
  35.             {
  36.                 Console.Write(new string('.', (n - 1) / 2));
  37.                 Console.Write("#");
  38.                 Console.Write(new string('.', n - 2));
  39.                 Console.Write("#");
  40.                 Console.WriteLine(new string('.', (n - 1) / 2));
  41.             }
  42.             PrintCenter(n);
  43.         }
  44.  
  45.  
  46.         static void PrintCenter(int n)
  47.         {
  48.  
  49.             Console.Write(new string('#', (n / 2) + 1));
  50.             Console.Write(new string('.', n - 2));
  51.             Console.WriteLine(new string('#', (n / 2) + 1));
  52.             PrintLower(n);
  53.         }
  54.  
  55.         static void PrintLower(int n)
  56.         {
  57.             int constant = (n * 2) - 1;
  58.             int c = 0;
  59.             int howmanyi = 4;
  60.             for (int r = 1; r <= n - 1; r++)
  61.             {
  62.                 c = constant - howmanyi;
  63.            
  64.                 Console.Write(new string('.', r));
  65.                 Console.Write("#");
  66.                 if (c > 0)
  67.                 {
  68.                     Console.Write(new string('.', c));
  69.                     Console.Write("#");
  70.                 }
  71.  
  72.                 Console.WriteLine(new string('.', r));
  73.  
  74.                 howmanyi += 2;
  75.  
  76.             }
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement