zh_stoqnov

The explorer

Oct 26th, 2014
228
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. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace The_ExplorerSOLUTION
  8. {
  9. class TheExplorer
  10. {
  11. static void Main(string[] args)
  12. {
  13. int height = int.Parse(Console.ReadLine());
  14. int width = height;
  15. string star = "*";
  16. string dash = "-";
  17. int upperPart = height / 2;
  18. int lowerPart = width / 2;
  19. for(int i = 0; i < height; i++)
  20. {
  21. for (int k = 0; k < width; k++)
  22. {
  23. if(i == 0 && k == width / 2)
  24. {
  25. Console.Write(star);
  26. }
  27. else if(i > 0 && k == upperPart)
  28. {
  29. Console.Write(star);
  30. }
  31. else if(i > 0 && k == lowerPart)
  32. {
  33. Console.Write(star);
  34. }
  35. else
  36. {
  37. Console.Write(dash);
  38. }
  39. }
  40. if (i < width / 2)
  41. {
  42. upperPart--;
  43. lowerPart++;
  44. }
  45. else
  46. {
  47. upperPart++;
  48. lowerPart--;
  49. }
  50. Console.WriteLine();
  51. }
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment