ellapt

SandClock

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