Benjail

2.5

Aug 26th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             bool programopen = true;
  10.             while ( programopen==true)
  11.             {              
  12.                 Console.WriteLine("Введите имя:");
  13.                 string name = Console.ReadLine();
  14.                 Console.WriteLine("Введите символ:");
  15.                 char symbol = Convert.ToChar(Console.ReadLine());
  16.                 int i = 0;
  17.                 while (i<name.Length+4) //Печать верхней строки
  18.                 {
  19.                     Console.Write(symbol);                          
  20.                     i++;
  21.                 }
  22.                 Console.Write("\n");
  23.                 Console.Write(symbol+" "+ name +" "+ symbol); //Печать средней строки с двумя символами,двумя пробелами и именем
  24.                 Console.Write("\n");
  25.                 i = 0;
  26.                 while (i < name.Length + 4) //печать нижней строки
  27.                 {
  28.                     Console.Write(symbol);
  29.                     i++;
  30.                 }
  31.                 Console.Write("\n");
  32.             }            
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment