Advertisement
Mitaka00

House

Feb 20th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace House
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var n = int.Parse(Console.ReadLine());
  14. if (n % 2 == 0)
  15. {
  16. var dash = n / 2 - 1;
  17. var stars = 2;
  18. for (int row = 1; row <= n; row+=2)
  19. {
  20. if (dash >= 0) Console.Write(new string('-', dash));
  21. Console.Write(new string('*', stars));
  22. if (dash >= 0) Console.WriteLine(new string('-', dash));
  23. dash -= 1;
  24. stars += 2;
  25. }
  26. }
  27. else
  28. {
  29. var dash = n / 2;
  30. var stars = 1;
  31. for (int row = 1; row <= n; row+=2)
  32. {
  33. if (dash >= 0) Console.Write(new string('-', dash));
  34. Console.Write(new string('*', stars));
  35. if (dash >= 0) Console.WriteLine(new string('-', dash));
  36. dash -= 1;
  37. stars += 2;
  38. }
  39. }
  40. for (int row = 1; row <= n / 2; row++)
  41. {
  42. Console.Write("|");
  43. Console.Write(new string('*', n - 2));
  44. Console.WriteLine("|");
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement