Created
June 20, 2014 15:53
-
-
Save honux77/f190f848d88976fb0eba to your computer and use it in GitHub Desktop.
for joongil kim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.Threading; | |
| namespace SandClock | |
| { | |
| class Program | |
| { | |
| public static int space = 0; | |
| static void SandPrint(int n) | |
| { | |
| for (int j = n; j > 0; j--) | |
| { | |
| for (int i = 0; i < (n - j + space) / 2 + 20; i++) | |
| { | |
| Console.Write(" "); | |
| //for(int k = space; k > 0; k--) | |
| //{ | |
| // Console.Write(" "); | |
| //} | |
| } | |
| for (int i = 0; i < j; i++) | |
| { | |
| Console.Write("*"); | |
| } | |
| Console.WriteLine(); | |
| //Thread.Sleep(30); | |
| } | |
| } | |
| static void SandDum(int n) | |
| { | |
| for (int j = 0; j < n; j++) | |
| { | |
| for (int i = 0; i < (n - j + space) / 2 + 20; i++) | |
| { | |
| Console.Write(" "); | |
| } | |
| for (int i = j; i > 0; i--) | |
| { | |
| Console.Write("*"); | |
| } | |
| Console.WriteLine(); | |
| //Thread.Sleep(30); | |
| } | |
| } | |
| static void SandClock(int input) | |
| { | |
| for(int i = input; i > 0; i--) | |
| { | |
| space = 0; | |
| for (int j = i; j < input; j++) | |
| { | |
| Console.WriteLine(); | |
| space++; | |
| } | |
| SandPrint(i); | |
| SandDum(10-i); | |
| Thread.Sleep(500); | |
| Console.Clear(); | |
| } | |
| } | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("창을 세로로 길게 늘리고 엔터를 쳐 주세요."); | |
| Console.ReadLine(); | |
| SandClock(10); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment