Advertisement
Guest User

Untitled

a guest
Mar 18th, 2015
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. using System;
  2.  
  3. class NewHouse
  4. {
  5. static void Main(string[] args)
  6. {
  7.  
  8. int oddNum = int.Parse(Console.ReadLine());
  9.  
  10. char asterics = '*';
  11. char dash = '-';
  12. char floors = '|';
  13. int roofDash = (oddNum - 1) / 2;
  14. int astericsCount = 1;
  15.  
  16.  
  17. Console.Write(new string(dash,roofDash));
  18. Console.Write(asterics);
  19. Console.WriteLine(new string(dash,roofDash));
  20. roofDash--;
  21. astericsCount += 2;
  22.  
  23. for (int i = 0; i <= oddNum; i++)
  24. {
  25. if(roofDash == 0)
  26. {
  27. Console.WriteLine(new string(asterics,astericsCount));
  28. break;
  29. }
  30. Console.Write(new string(dash,roofDash));
  31. Console.Write(new string(asterics,astericsCount));
  32. Console.WriteLine(new string(dash,roofDash));
  33. roofDash--;
  34. astericsCount += 2;
  35. }
  36. astericsCount -= 2;
  37. for (int i = 0; i < oddNum; i++)
  38. {
  39. Console.Write(floors);
  40. Console.Write(new string(asterics,astericsCount));
  41. Console.WriteLine(floors);
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement