Advertisement
KlimentHristov

Figure.Boat

Nov 23rd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2. class Boat
  3. {
  4.     static void Main()
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.  
  8.         char dot = '.';
  9.         char star = '*';
  10.         int firstDots = n - 1;
  11.         int firstStars = 1;
  12.  
  13.  
  14.         for (int i = 0; i < n/2; i++)
  15.         {
  16.             Console.WriteLine("{0}{1}{2}",
  17.                 new string (dot,firstDots),
  18.                 new string (star,firstStars),
  19.                 new string (dot,n));
  20.                 firstDots -= 2;
  21.                 firstStars += 2;      
  22.         }
  23.         Console.WriteLine("{0}{1}",new string (star,n),new string (dot,n));
  24.         for (int i = 0; i < n / 2; i++)
  25.         {
  26.             firstDots += 2;
  27.             firstStars -= 2;
  28.             Console.WriteLine("{0}{1}{2}",
  29.                 new string(dot, firstDots),
  30.                 new string(star, firstStars),
  31.                 new string(dot, n));
  32.            
  33.         }
  34.         int lastdots = 0;
  35.         int laststars = n * 2;
  36.         for (int i = 0; i < n/2; i++)
  37.         {
  38.             Console.WriteLine("{0}{1}{0}", new string(dot, lastdots),new string(star, laststars));
  39.             laststars -= 2;
  40.             lastdots++;
  41.  
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement