Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace The_ExplorerSOLUTION
- {
- class TheExplorer
- {
- static void Main(string[] args)
- {
- int height = int.Parse(Console.ReadLine());
- int width = height;
- string star = "*";
- string dash = "-";
- int upperPart = height / 2;
- int lowerPart = width / 2;
- for(int i = 0; i < height; i++)
- {
- for (int k = 0; k < width; k++)
- {
- if(i == 0 && k == width / 2)
- {
- Console.Write(star);
- }
- else if(i > 0 && k == upperPart)
- {
- Console.Write(star);
- }
- else if(i > 0 && k == lowerPart)
- {
- Console.Write(star);
- }
- else
- {
- Console.Write(dash);
- }
- }
- if (i < width / 2)
- {
- upperPart--;
- lowerPart++;
- }
- else
- {
- upperPart++;
- lowerPart--;
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment