Objective
Write a C# program to ask the user for three letters and display them in reverse order.
Write Your C# Exercise
C# Exercise Example
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
}
}
More C# Programming Exercises of Basic Data Types
Explore our set of C# programming exercises! Specifically designed for beginners, these exercises will help you develop a solid understanding of the basics of C#. From variables and data types to control structures and simple functions, each exercise is crafted to challenge you incrementally as you build confidence in coding in C#.
This exercise in C# aims to develop a program that prompts the user for a symbol and a width, and then displays a decreasing triangle of the spec...
This exercise in C# aims to develop a program that asks the user for their username and password (both as strings) and repeats the prompt as many...
This C# exercise involves creating a program that prompts the user for their username and password, both as strings. If the entered credentials do not m...
This C# programming exercise requires creating a program that asks the user for two numbers and an operation to perform on them. The supported operations are ...
In this C# programming exercise, you need to create a program that asks the user for two numbers and a mathematical operation to perform between them. Supporte...
In this C# programming exercise, you need to create a program that calculates the perimeter, area, and diagonal of a rectangle, given its widt...