Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
569
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. using System;
  2. class House
  3. {
  4. static void Main()
  5. {
  6. int n = int.Parse(Console.ReadLine());
  7. int stars;
  8. if (n % 2 == 0)
  9. {
  10. stars = 2;
  11. }
  12. else
  13. {
  14. stars = 1;
  15. }
  16. int lines = (n - stars) / 2;
  17. Console.Write(new string('-', lines));
  18. Console.Write(new string('*', stars));
  19. Console.WriteLine(new string('-', lines));
  20. for (int i = 1; i < (n + 1) / 2; i++)
  21. {
  22. stars = stars + 2;
  23. lines = lines - 1;
  24. Console.Write(new string('-', lines));
  25. Console.Write(new string('*', stars));
  26. Console.WriteLine(new string('-', lines));
  27.  
  28. }
  29. for (int i = 0; i <= n / 2 - 1; i++)
  30. {
  31. Console.Write("|");
  32. Console.Write(new string('*', n - 2));
  33. Console.Write("|");
  34. Console.WriteLine();
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement