Exercise
Char
Objetive
Write a C# program to ask the user for three letters and display them in reverse order.
Example Code
using System; // Import the System namespace to use basic classes like Console
class Program // Define the main class of the program
{
static void Main() // The entry point of the program
{
// Ask the user to enter the first letter
Console.Write("Enter the first letter: ");
char letter1 = Console.ReadKey().KeyChar; // Read a character input from the user
// Ask the user to enter the second letter
Console.Write("\nEnter the second letter: ");
char letter2 = Console.ReadKey().KeyChar; // Read a character input from the user
// Ask the user to enter the third letter
Console.Write("\nEnter the third letter: ");
char letter3 = Console.ReadKey().KeyChar; // Read a character input from the user
// Display the letters in reverse order
Console.WriteLine($"\nThe letters in reverse order are: {letter3} {letter2} {letter1}"); // Show the letters in reverse order
}
}