Advertisement
kuruku

KaspichanBoat

Apr 14th, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.22 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 KaspichaniaBoats
  8. {
  9.     class KaspichaniaBoats
  10.     {
  11.         static void Main()
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             int outerDots = n;
  16.             int innerDots = 0;
  17.  
  18.             for (int i = 0; i < n; i++)
  19.             {
  20.                 Console.Write(new string('.', outerDots));
  21.                 if (i != 0)
  22.                 {
  23.                     Console.Write("*");
  24.                 }
  25.                 Console.Write(new string('.', innerDots));
  26.                 Console.Write("*");
  27.                 Console.Write(new string('.', innerDots));
  28.                 if (i != 0)
  29.                 {
  30.                     Console.Write("*");
  31.                 }
  32.                 Console.WriteLine(new string('.', outerDots));
  33.  
  34.                 outerDots--;
  35.                 if (outerDots < n - 1)
  36.                 {
  37.                     innerDots++;
  38.                 }
  39.             }
  40.             Console.WriteLine(new string('*', 2 * n + 1));
  41.  
  42.             outerDots = 1;
  43.             innerDots = n - 2;
  44.  
  45.             for (int i = n / 2 + 1; i > 0 ; i--)
  46.             {
  47.                 Console.Write(new string('.', outerDots));
  48.                 if (i != 0)
  49.                 {
  50.                     Console.Write("*");
  51.                 }
  52.                 if (i == 1)
  53.                 {
  54.                     Console.Write(new string('*', innerDots));
  55.                 }
  56.                 else
  57.                 {
  58.                     Console.Write(new string('.', innerDots));
  59.                 }
  60.                 Console.Write("*");
  61.                 if (i == 1)
  62.                 {
  63.                     Console.Write(new string('*', innerDots));
  64.                 }
  65.                 else
  66.                 {
  67.                     Console.Write(new string('.', innerDots));
  68.                 }
  69.                 if (i != 0)
  70.                 {
  71.                     Console.Write("*");
  72.                 }
  73.                
  74.                 Console.WriteLine(new string('.', outerDots));
  75.  
  76.                 outerDots++;
  77.                 innerDots--;
  78.                
  79.             }
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement