Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Sandglass_Second
- {
- class Sandglass_Second
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- int M = 1;
- if (N % 2 != 0)
- {
- for (int i = 1; i <= M; i++)
- {
- if (M <= N - i)
- {
- Console.WriteLine("{0}{1}{0}", new string(' ', i), new string('*', N - M - i));
- System.Threading.Thread.Sleep(1000);
- M++;
- }
- }
- for (int j = M; j >= 1; j--)
- {
- if (M < N - j)
- {
- M--;
- Console.WriteLine("{0}{1}{0}", new string(' ', j), new string('*', N - M - j + 1));
- System.Threading.Thread.Sleep(1000);
- }
- }
- }
- else
- {
- for (int i = 1; i <= M; i++)
- {
- if (M <= N - i)
- {
- Console.WriteLine("{0}{1}{0}", new string(' ', i), new string('*', N - M - i + 1));
- System.Threading.Thread.Sleep(1000);
- M++;
- }
- }
- for (int j = M; j >= 0; j--)
- {
- if (M < N - j)
- {
- M--;
- Console.WriteLine("{0}{1}{0}", new string(' ', j + 1), new string('*', N - M - j + 1));
- System.Threading.Thread.Sleep(1000);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement