Advertisement
koksibg

Sandglass

Jul 28th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 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 Draw_Figure
  8. {
  9.     class Draw_Figure
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int N = int.Parse(Console.ReadLine());
  14.             Console.WriteLine(new string('*', N));
  15.             int M = 1;
  16.             for (int i = 1; i <= M; i++)
  17.             {
  18.                 if (M <= N - i)
  19.                 {
  20.                     Console.WriteLine("{0}{1}{0}", new string('.', i), new string('*', N - M - i));
  21.                     M++;
  22.                 }
  23.             }
  24.             for (int j = M; j >= 1; j--)
  25.             {
  26.                 if (M < N - j)
  27.                 {
  28.                     M--;
  29.                     Console.WriteLine("{0}{1}{0}", new string('.', j), new string('*', N - M - j + 1));
  30.                 }
  31.             }
  32.             Console.WriteLine(new string('*', N));
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement