Моето решение на Sand Glass
Мисля ,че стана доста добре ! И си е авторско !
using System;
class SandGlass
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
int copyOfN = n;
int points ;
int p = 0;
int stars;
int s = n;
//upper part
do
{
for (points = 0; points <= p; points ++)
{
Console.Write(".");
}
for (stars = 0; stars < s; stars ++)
{
Console.Write("*");
}
for (points = 0; points <= p; points ++)
{
Console.Write(".");
}
Console.WriteLine();
p = p + 1;
s = s - 2;
n = n - 2;
} while (n > 0); // n = -1, p = number of rows, s = -1
// going down
n = copyOfN;
p = p - 2;
s = 3;
// down part
do
{
for (points = 0; points <= p; points++)
{
Console.Write(".");
}
for (stars = 0; stars < s; stars++)
{
Console.Write("*");
}
for (points = 0; points <=p; points++)
{
Console.Write(".");
}
Console.WriteLine();
p = p - 1;
s = s + 2;
n = n - 2;
} while (n > 2);
Console.WriteLine(n);
Console.ReadLine();
}
}