Advertisement
stefan1919

House

Aug 25th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 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 ConsoleApplication4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             for (int i = 0; i <= n / 2; i++)
  15.             {
  16.                 string outerDots = new string('.', n / 2 - i);
  17.                 if (i == 0)
  18.                 {
  19.                     Console.WriteLine(outerDots + "*" + outerDots);
  20.                 }
  21.                 else
  22.                 {
  23.                     string innerDots = new string('.', 2 * i - 1);
  24.                     if (i == n /2)
  25.                     {
  26.                         string line = new string('*', n);
  27.                         Console.WriteLine(line);
  28.                     }
  29.                     else
  30.                     {
  31.                         Console.WriteLine(outerDots + "*" + innerDots + "*" + outerDots);
  32.                     }
  33.                 }
  34.             }
  35.             for (int j = 0; j < n / 2; j++)
  36.             {
  37.                 string outerDots = new string('.', n / 4);
  38.                 string innerDots = new string('.', n - 2 - 2 * (n / 4));
  39.                 if (j == n / 2 - 1)
  40.                 {
  41.                     string line = new string('*', n - 2 * (n / 4));
  42.                     Console.WriteLine(outerDots + line + outerDots);
  43.                 }
  44.                 else
  45.                {
  46.                    Console.WriteLine(outerDots + "*" + innerDots + "*" + outerDots);
  47.                }
  48.  
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement