Advertisement
kdikov

Sandglass

Dec 24th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. class SandGlass
  4. {
  5.     static void Main()
  6.     {
  7.         int n = int.Parse(Console.ReadLine());
  8.         int temp = 0;
  9.        
  10.         for (int i = 0; i < n; i++)
  11.         {
  12.             temp = n / 2 - Math.Abs(n / 2 - i);
  13.            
  14.             for (int j = 0; j < n; j++)
  15.             {
  16.                 if (j < temp || j > n - temp - 1)
  17.                 {
  18.                     Console.Write(".");
  19.                 }
  20.                 else
  21.                 {
  22.                     Console.Write("*");
  23.                 }
  24.             }
  25.             Console.WriteLine();
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement