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. }
 
 

61

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

Redci
20
Riječi
56
Veličina
526 byte-a
Stvoreno
Vrsta
text/x-csharp
All Rights Reserved ((C))
Prijavi se, ako želiš komentirati!