Advertisement
ivelin_m

DiamondTrolls

Apr 5th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.72 KB | None | 0 0
  1. using System;
  2.  
  3.     class DiamondTrolls
  4.     {
  5.         static void Main()
  6.         {
  7.             int n = int.Parse(Console.ReadLine());
  8.             //first part
  9.             Console.Write(new string('.',n / 2 + 1));
  10.             Console.Write(new string('*', n));
  11.             Console.WriteLine(new string('.', n / 2 + 1));
  12.  
  13.             //second part
  14.             int outerDots = n / 2;
  15.             int innerDots = n / 2;
  16.             for (int i = 0; i < n/2; i++)
  17.             {
  18.                 Console.Write(new string('.',outerDots));
  19.                 Console.Write("*");
  20.                 Console.Write(new string('.', innerDots));
  21.                 Console.Write("*");
  22.                 Console.Write(new string('.', innerDots));
  23.                 Console.Write("*");
  24.                 Console.WriteLine(new string('.', outerDots));
  25.  
  26.                 innerDots++;
  27.                 outerDots--;
  28.             }
  29.  
  30.             //third part
  31.             Console.WriteLine(new string('*',n * 2 + 1));
  32.  
  33.             //forth part
  34.             outerDots = 1;
  35.             innerDots = n - 2;
  36.             for (int i = 0; i < n - 1; i++)
  37.             {
  38.                 Console.Write(new string('.', outerDots));
  39.                 Console.Write("*");
  40.                 Console.Write(new string('.', innerDots));
  41.                 Console.Write("*");
  42.                 Console.Write(new string('.', innerDots));
  43.                 Console.Write("*");
  44.                 Console.WriteLine(new string('.', outerDots));
  45.  
  46.                 innerDots--;
  47.                 outerDots++;
  48.             }
  49.  
  50.             //fifth part
  51.             Console.Write(new string('.',n));
  52.             Console.Write("*");
  53.             Console.WriteLine(new string('.', n));
  54.         }
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement