Skip to content

Instantly share code, notes, and snippets.

@Strelok78
Last active May 16, 2023 16:03
Show Gist options
  • Save Strelok78/fe373897901c0bbcc8f6e19a4ddc5523 to your computer and use it in GitHub Desktop.
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.
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