Advertisement
Kolimnared

House

Oct 17th, 2014
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. class House
  4. {
  5. static void Main(string[] args)
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8.  
  9. int outsideDots = ((n - 1) / 2);
  10. int insideDots = 1;
  11.  
  12. Console.WriteLine("{0}*{0}", new string('.', outsideDots--));
  13. for (int i = 1; i < (n+1)/2 - 1; i++)
  14. {
  15. Console.WriteLine("{0}*{1}*{0}", new string('.', outsideDots), new string('.', insideDots));
  16. outsideDots--;
  17. insideDots += 2;
  18. }
  19. Console.WriteLine(new string('*', n));
  20.  
  21. outsideDots = (n / 4);
  22. insideDots = (n - 2) - (outsideDots * 2);
  23. string baseOfHouse = new string('.', outsideDots) + "*" + new string('.', insideDots) + "*" + new string('.', outsideDots);
  24.  
  25. for (int i = 0; i < (n - 1)/2 - 1; i++)
  26. {
  27. Console.WriteLine(baseOfHouse);
  28. }
  29.  
  30. Console.WriteLine("{0}{1}{0}", new string('.', outsideDots), new string('*', (insideDots + 2)));
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement