Answer :
Answer:
The solution code is given below
- using System;
- using System.Linq;
- public class Program
- {
- public static void Main()
- {
- string[] letters = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T","U", "V", "W", "X", "Y", "Z"};
- Console.WriteLine("Please input a letter: ");
- string input_letter = Console.ReadLine();
- if(letters.Contains(input_letter)){
- Console.WriteLine("OK");
- }else{
- Console.WriteLine("Error. Not uppercase letter.");
- }
- }
- }
Explanation:
Firstly we import the necessary libraries, System and Linq (Line 1-2).
Next we create a string array to hold all uppercase letters (Line 8).
Next, we prompt user to input a letter using the ReadLine() method (Line 10 - 11)
At last, we define if and else conditions to check if the letters contains the input letter. If so, print ok else print an error message. (Line 13-17)