0% found this document useful (0 votes)
11 views1 page

Example 1 - Switch Statement

The document contains a C# program that prompts the user to enter a letter and determines if it is a vowel or not. It uses a switch statement to check the lowercase version of the input character against the vowels 'a', 'e', 'i', 'o', and 'u'. If the character is not a vowel, it outputs 'Not a vowel'.

Uploaded by

twthyy9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views1 page

Example 1 - Switch Statement

The document contains a C# program that prompts the user to enter a letter and determines if it is a vowel or not. It uses a switch statement to check the lowercase version of the input character against the vowels 'a', 'e', 'i', 'o', and 'u'. If the character is not a vowel, it outputs 'Not a vowel'.

Uploaded by

twthyy9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

//ProgrammingAdvices.

com
//Mohammed Abu-Hadhoud

using System;

namespace Main
{
internal class Program
{

static void Main(string[] args)


{

char ch;
Console.WriteLine("Enter a letter?");
ch = Convert.ToChar(Console.ReadLine());

switch (Char.ToLower(ch))
{
case 'a':
Console.WriteLine("Vowel");
break;
case 'e':
Console.WriteLine("Vowel");
break;
case 'i':
Console.WriteLine("Vowel");
break;
case 'o':
Console.WriteLine("Vowel");
break;
case 'u':
Console.WriteLine("Vowel");
break;
default:
Console.WriteLine("Not a vowel");
break;
}

Console.ReadKey();

}
}
}

You might also like