Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace MMLogo
- {
- class Program
- {
- static void Main(string[] args)
- {
- int rows = int.Parse(Console.ReadLine());
- int cols = rows * 5;
- StringBuilder sb = new StringBuilder();
- for (int row = 0; row <= rows; row++)
- {
- List<char> line = new List<char>();
- for (int col = 0; col < cols; col++)
- {
- if (FirstCheck(rows, row, col) ||
- SecondCheck(rows, row, col) ||
- ThirdCheck(rows,row,col) ||
- FourthCheck(rows,row,col))
- {
- line.Add('*');
- }
- else
- {
- line.Add('-');
- }
- }
- sb.Append(string.Join("",line));
- sb.Append(string.Join("",line));
- sb.AppendLine();
- }
- Console.WriteLine(sb.ToString());
- }
- public static bool FirstCheck(int rows, int row, int col)
- {
- int index = rows - 1 - row;
- if (col > index && col <= index+ rows)
- {
- return true;
- }
- return false;
- }
- public static bool SecondCheck(int rows, int row, int col)
- {
- int index = rows - 1 + row;
- if (col > index && col <= index + rows)
- {
- return true;
- }
- return false;
- }
- public static bool ThirdCheck(int rows, int row, int col)
- {
- int index = 3 * rows - 1 - row;
- if (col > index && col <= index + rows)
- {
- return true;
- }
- return false;
- }
- public static bool FourthCheck(int rows, int row, int col)
- {
- int index = 3 * rows - 1 + row;
- if (col > index && col <= index + rows)
- {
- return true;
- }
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement