using System;
class Program
{
static void Main()
{
Console.WriteLine("Welcome to the Greeting Program!");
Console.Write("Please enter your name: ");
// Read user input
string userName = Console.ReadLine();
// Greet the user
Console.WriteLine($"Hello, {userName}! Welcome to C# programming.");
// Keep the console window open until a key is pressed
Console.WriteLine("\nPress any key to exit...");
Console.ReadKey();
}
}
The C# code provided is a simple console application that prompts the user for their name, greets them with a personalized message, and waits for any key press before exiting.
Por favor faça seu login para deixar um comentário!