3
21/10/2024 5:59 pm
Topic starter
SoftUni has opened a new training center in Kaspichan, but the people there did not know how to find it. Your task is to print a vertical arrow, which will be used to indicate the path to the new building in the city. This will help thousands of people to become software engineers. Please help them!
Input
The input data should be read from the console.
- On the only line will hold and integer number N (always odd number), indicating the width of the arrow.
The input data will always be valid and in the format described. There is no need to check it explicitly.
Output
The output should be printed on the console. Use the “#” (number sign) to mark the arrow and “.” (dot) for the rest. Follow the examples below.
Constraints
- N will always be a positive odd number between 3 and 79 inclusive.
- Allowed working time for your program: 0.1 seconds.
- Allowed memory: 16 MB.
Examples
1 Answer
2
21/10/2024 6:02 pm
Here's my drawing solution, dude:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Arrow { static void Main() { int n = int.Parse(Console.ReadLine()); Console.WriteLine("{0}{1}{0}", new string('.', ((n * 2 - 1) - n) / 2), new string('#', n));//1ST PART - STATIC for (int i = 0; i < n - 2; i++)//2ND PART { Console.WriteLine("{0}{1}{2}{1}{0}", new string('.', n / 2), new string('#', 1), new string('.', n - 2)); } Console.WriteLine("{0}{1}{0}", new string('#', n / 2 + 1), new string('.', ((n * 2 - 1) - 2 * (n / 2 + 1))));//3RD PART - STATIC for (int i = 0; i < n - 2; i++)//4TH PART { Console.WriteLine("{0}{1}{2}{1}{0}", new string('.', i + 1), new string('#', 1), new string('.', ((n * 2 - 1) - 4 - (i*2)))); } Console.WriteLine("{0}{1}{0}", new string('.',n-1), new string('#', 1));//5TH PART - STATIC } }