Advertisement
grach

2017_18_March_Soft Uni Logo

Jul 20th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.16 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 SoftUniLogo
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             var height = 4 * n - 2;
  16.             var width = 12 * n - 5;
  17.  
  18.             for (int i = 1/*брой # на ред*/; i <= 2 * n /*брой редове*/; i++)
  19.             {
  20.                 {
  21.                     var numberOfHashTag = i * 6 - 5;
  22.                     var numberOfDots = (width - numberOfHashTag) / 2;
  23.                     Console.Write(new string('.', numberOfDots));
  24.                     Console.Write(new string('#', numberOfHashTag));
  25.                     Console.WriteLine(new string('.', numberOfDots));
  26.                 }
  27.             }
  28.             var numberOfDotsInSecondHalf = 3;
  29.  
  30.             for (int i = 0; i < n - 2; i++)
  31.             {
  32.                 var numberOfDieses = width - numberOfDotsInSecondHalf * 2;
  33.                 Console.Write("|");
  34.                 Console.Write(new string('.', numberOfDotsInSecondHalf - 1));
  35.                 Console.Write(new string('#', numberOfDieses));
  36.                 Console.WriteLine(new string('.', numberOfDotsInSecondHalf));
  37.                 numberOfDotsInSecondHalf += 3; //увеличаваме броя на точките във втората половина
  38.             }
  39.  
  40.             for (int i = 0; i < n - 1; i++)
  41.             {
  42.                 var numberOfDieses = width - numberOfDotsInSecondHalf * 2;
  43.                 Console.Write("|");
  44.                 Console.Write(new string('.', numberOfDotsInSecondHalf - 1));
  45.                 Console.Write(new string('#', numberOfDieses));
  46.                 Console.WriteLine(new string('.', numberOfDotsInSecondHalf));
  47.             }
  48.  
  49.             var numberOfDieses2 = width - numberOfDotsInSecondHalf * 2;
  50.             Console.Write("@");
  51.             Console.Write(new string('.', numberOfDotsInSecondHalf - 1));
  52.             Console.Write(new string('#', numberOfDieses2));
  53.             Console.WriteLine(new string('.', numberOfDotsInSecondHalf));
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement