- Course
- Data types B
- Check vowels with switch
Check vowels with switch
Last updated:
8/23/2020
⁃
Difficulty:
Easy
Create a C# program that asks the user for a letter (x) and check if it is a vowel or other symbol.
Display on the Vocal screen or Other symbol.
Input
a
Output
Vowel
Solution
using System;
public class CheckVowelWithSwitch
{
public static void Main(string[] args)
{
string x = Console.ReadLine();
x = x.ToLower();
switch (x)
{
case "a":
case "e":
case "i":
case "o":
case "u":
Console.WriteLine("Vowel");
break;
default:
Console.Write("Other symbol");
break;
}
}
}