Advertisement
Asinka

03. Sand-glass (7 Dec 2011 Morning)

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