1. using System;
  2. class Program
  3. {
  4. static void Main()
  5. {
  6. Console.WriteLine("Welcome to the Greeting Program!");
  7. Console.Write("Please enter your name: ");
  8. // Read user input
  9. string userName = Console.ReadLine();
  10. // Greet the user
  11. Console.WriteLine($"Hello, {userName}! Welcome to C# programming.");
  12. // Keep the console window open until a key is pressed
  13. Console.WriteLine("\nPress any key to exit...");
  14. Console.ReadKey();
  15. }
  16. }
 
 

113

Pasted Text #34501

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.

PasteBin

Linhas
20
Palavras
56
Tamanho
526 bytes
Criado
Tipo
text/x-csharp
All Rights Reserved ((C))
Por favor faça seu login para deixar um comentário!