stoyanmkd

Star

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