Last active
May 16, 2023 16:03
-
-
Save Strelok78/fe373897901c0bbcc8f6e19a4ddc5523 to your computer and use it in GitHub Desktop.
Prints the name in a rectangle from the character that the user enters himself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyCode | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string name; | |
string nameLine; | |
string symbolLine = ""; | |
char symbol; | |
Console.WriteLine("Enter your name:"); | |
name = Console.ReadLine(); | |
Console.WriteLine("Enter symbol:"); | |
symbol = Console.ReadKey().KeyChar; | |
nameLine = symbol + name + symbol; | |
for (int i = 0; i < nameLine.Length; i++) | |
{ | |
symbolLine += symbol; | |
} | |
Console.WriteLine("\n" + symbolLine + "\n" + nameLine + "\n" + symbolLine); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment