Advertisement
Filkolev

Sandglass

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