Advertisement
SaNik74

nameOutput

Feb 8th, 2024 (edited)
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. class Program
  2. {
  3.     static void Main(string[] args)
  4.     {
  5.         char symbol;
  6.         string name;
  7.         string midleLine;
  8.         string frame = "";
  9.         int stringLenght;
  10.  
  11.         Console.Write("Введите имя:");
  12.         name = Console.ReadLine();
  13.  
  14.         Console.Write("Введите символ:");
  15.         symbol = Convert.ToChar(Console.ReadLine());
  16.  
  17.         midleLine = symbol + name + symbol;
  18.         stringLenght = midleLine.Length;
  19.  
  20.         for (int i = 0; i < stringLenght; i++)
  21.         {
  22.             frame += symbol;
  23.         }
  24.  
  25.         Console.WriteLine($"{frame}\n{midleLine}\n{frame}");
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement