Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace MMLogo
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int rows = int.Parse(Console.ReadLine());
  12. int cols = rows * 5;
  13. StringBuilder sb = new StringBuilder();
  14. for (int row = 0; row <= rows; row++)
  15. {
  16. List<char> line = new List<char>();
  17. for (int col = 0; col < cols; col++)
  18. {
  19. if (FirstCheck(rows, row, col) ||
  20. SecondCheck(rows, row, col) ||
  21. ThirdCheck(rows,row,col) ||
  22. FourthCheck(rows,row,col))
  23. {
  24. line.Add('*');
  25. }
  26. else
  27. {
  28. line.Add('-');
  29. }
  30. }
  31.  
  32. sb.Append(string.Join("",line));
  33. sb.Append(string.Join("",line));
  34. sb.AppendLine();
  35. }
  36.  
  37. Console.WriteLine(sb.ToString());
  38. }
  39.  
  40. public static bool FirstCheck(int rows, int row, int col)
  41. {
  42. int index = rows - 1 - row;
  43. if (col > index && col <= index+ rows)
  44. {
  45. return true;
  46. }
  47.  
  48. return false;
  49. }
  50.  
  51. public static bool SecondCheck(int rows, int row, int col)
  52. {
  53. int index = rows - 1 + row;
  54. if (col > index && col <= index + rows)
  55. {
  56. return true;
  57. }
  58.  
  59. return false;
  60. }
  61.  
  62. public static bool ThirdCheck(int rows, int row, int col)
  63. {
  64. int index = 3 * rows - 1 - row;
  65. if (col > index && col <= index + rows)
  66. {
  67. return true;
  68. }
  69.  
  70. return false;
  71. }
  72.  
  73. public static bool FourthCheck(int rows, int row, int col)
  74. {
  75. int index = 3 * rows - 1 + row;
  76. if (col > index && col <= index + rows)
  77. {
  78. return true;
  79. }
  80.  
  81. return false;
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement