Venciity

[SoftUni C# exam preparation] 03.SandGlass

Apr 9th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3.     class SandGlass
  4.     {
  5.         static void Main()
  6.         {
  7.             int n = Int32.Parse(Console.ReadLine());
  8.  
  9.             for (int i = 0; i <= n / 2; i++)
  10.             {
  11.                 string dots = new string('.', i);
  12.                 string stars = new string('*', n - 2 * i);
  13.                 Console.WriteLine("{0}{1}{0}", dots, stars);
  14.             }
  15.  
  16.             for (int i = n / 2 - 1; i >= 0; i--)
  17.             {
  18.                 string dots = new string('.', i);
  19.                 string stars = new string('*', n - 2 * i);
  20.                 Console.WriteLine("{0}{1}{0}", dots, stars);
  21.             }
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment