Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _1._Stars
- {
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int numOfStars = int.Parse(Console.ReadLine());//Колко звезди да има по края: 1, 2 и т.н.
- string stars = new string('*', numOfStars);
- int neededWhiteSpaces = n - 2 * stars.Length;//Смятаме колко празни места ни трябват
- Console.WriteLine(new string('*', n));
- for (int i = 0; i < n - 2; i++)
- {
- Console.WriteLine("{1}{0}{1}", new string(' ', neededWhiteSpaces), stars);
- //Console.WriteLine($"{stars}{new string(' ', neededWhiteSpaces)}{stars}");// Друг начин за печатане
- }
- Console.WriteLine(new string('*', n));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement