vaseto_v

House

Sep 3rd, 2015
204
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.  
  4.  
  5. class House
  6. {
  7.     static void Main()
  8.     {
  9.         int N = int.Parse(Console.ReadLine());
  10.         string star = "*";
  11.         string dot = ".";
  12.         int left = N / 2;
  13.         int right = N / 2;
  14.  
  15.  
  16.         for (int row = 0; row < ((N + 1) / 2) - 1; row++)
  17.         {
  18.             for (int col = 0; col < N; col++)
  19.             {
  20.                 if(row == 0 && col == N /2)
  21.                 {
  22.                     Console.Write(star);
  23.                 }
  24.                 else if( row > 0 && col == left)
  25.                 {
  26.                     Console.Write(star);
  27.                 }
  28.                 else if (row > 0 && col == right)
  29.                 {
  30.                     Console.Write(star);
  31.                 }
  32.                 else
  33.                 {
  34.                     Console.Write(dot);
  35.                 }
  36.  
  37.                
  38.             }
  39.  
  40.            
  41.            
  42.  
  43.             Console.WriteLine();
  44.             left--;
  45.             right++;
  46.         }
  47.  
  48.         Console.WriteLine(new string('*', N));
  49.  
  50.         for (int i = N / 2 + 1; i < N  ; i++)
  51.         {
  52.             if( i == N - 1 )
  53.             {
  54.                 Console.Write(new string('.', N / 4));
  55.                 Console.Write(new string('*', N - (N / 2)  ));
  56.                 Console.WriteLine(new string('.', N / 4));
  57.  
  58.                
  59.  
  60.             }
  61.             else
  62.             {
  63.                 Console.WriteLine("{0}*{1}*{0}", new string('.', N / 4), new string('.', N  - N / 2  - 2));
  64.             }
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment