zh_stoqnov

House

Oct 27th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 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 House
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. string dotTopHalf = new string('.', (n-1) / 2);
  15. string star = "*";
  16. string dot = ".";
  17. string roofTop = dotTopHalf + star + dotTopHalf;
  18. for (int i = 0; i < (n-1) / 2; i++)
  19. {
  20. if (i == 0)
  21. {
  22. Console.WriteLine(roofTop);
  23. }
  24. else
  25. {
  26. string dotHalf = new string('.', ((n - 1) / 2) - i);
  27. string dotMiddle = new string('.', (2 * i) - 1);
  28. Console.WriteLine(dotHalf + star + dotMiddle + star + dotHalf);
  29. }
  30. }
  31. string roofLow = new string('*', n);
  32. Console.WriteLine(roofLow);
  33. int wall = n / 4;
  34. for (int i = 0; i < (n - 1) / 2 - 1; i++)
  35. {
  36. Console.Write(new string('.', wall));
  37. Console.Write(new string('*', 1));
  38. Console.Write(new string('.', n - 2 * wall - 2));
  39. Console.Write(new string('*', 1));
  40. Console.WriteLine(new string('.', wall));
  41. }
  42. Console.Write(new string('.', wall));
  43. Console.Write(new string('*', n - 2 * wall));
  44. Console.WriteLine(new string('.', wall));
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment