Advertisement
Gesh4o

TheExplorer

Sep 17th, 2015
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. using System;
  2.  
  3. class TheExplorer
  4. {
  5. static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. int outerDashesCount = n / 2;
  9.  
  10. for (int rows = 1; rows <= n;rows++ )
  11. {
  12. if (rows==1 ||rows == n)
  13. {
  14. Console.WriteLine("{0}{1}{0}", new string('-', outerDashesCount),
  15. new string('*', 1));
  16. }
  17. else
  18. {
  19. int innerDashesCount = 1;
  20.  
  21. for (int i = 0; i < n/2; i++)
  22. {
  23. outerDashesCount--;
  24. Console.WriteLine("{0}{1}{2}{1}{0}", new string('-', outerDashesCount),
  25. new string('*', 1),
  26. new string('-',innerDashesCount));
  27. innerDashesCount += 2;
  28. }
  29.  
  30.  
  31. innerDashesCount -= 2;
  32.  
  33.  
  34. for (int i = 0; i < (n/2)-1; i++)
  35. {
  36. outerDashesCount++;
  37. innerDashesCount -= 2;
  38.  
  39. Console.WriteLine("{0}{1}{2}{1}{0}", new string('-', outerDashesCount),
  40. new string('*', 1),
  41. new string('-', innerDashesCount));
  42. }
  43. return;
  44. }
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement