Advertisement
rukvir

HW 2_7

Feb 12th, 2025
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HW_2025
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string userSymbol = "";
  10.             string userName = "";
  11.             int borderedNameLines = 3;
  12.             int userNameLines = 2;
  13.  
  14.             Console.WriteLine("Введите сивол для обводки имени?");
  15.             userSymbol = Console.ReadLine();
  16.             Console.WriteLine("Введите ваше имя");
  17.             userName = Console.ReadLine();
  18.  
  19.             for(int i = 1; i <= borderedNameLines; i++)
  20.             {
  21.                 if (i == userNameLines)
  22.                 {
  23.                     Console.Write($"\n{userSymbol}");
  24.                     Console.Write(userName);
  25.                     Console.WriteLine(userSymbol);
  26.                 }
  27.                 else
  28.                 {
  29.                     for (int j = 0; j < userName.Length + userNameLines; j++)
  30.                     {
  31.                         Console.Write(userSymbol);
  32.                     }
  33.                 }
  34.                
  35.             }
  36.             Console.ReadKey();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement