Advertisement
Guest User

Untitled

a guest
May 13th, 2017
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.50 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 _05.SoftUniLogo
  8. {
  9.     class SoftUniLogo
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             int dots = (12 * n - 6) / 2;
  16.             int sharps = 1;
  17.  
  18.             // This loop draws the top of hat:
  19.             for (int i = 0; i < 2 * n; i++)
  20.             {
  21.                 Console.WriteLine("{0}{1}{0}", new string('.', dots), new string('#', sharps));
  22.                 dots -= 3;
  23.                 sharps += 6;
  24.             }
  25.  
  26.             // This loop draws the next n - 2 rows:
  27.             dots = 3;
  28.             sharps -= 12;
  29.             for (int i = 0; i < n - 2; i++)
  30.             {
  31.                 Console.WriteLine("|{0}{1}{2}", new string('.', dots - 1), new string('#', sharps), new string('.', dots));
  32.                 dots += 3;
  33.                 sharps -= 6;
  34.             }
  35.  
  36.             // This loop draws the last n rows:
  37.             for (int i = 0; i < n; i++)
  38.             {
  39.                 if (i == n - 1)
  40.                 {
  41.                     Console.WriteLine("@{0}{1}{2}", new string('.', dots - 1), new string('#', sharps), new string('.', dots));
  42.                 }
  43.                 else
  44.                 {
  45.                     Console.WriteLine("|{0}{1}{2}", new string('.', dots - 1), new string('#', sharps), new string('.', dots));
  46.                 }
  47.             }
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement