Switch case statements test the value of a variable and compare it with multiple cases. Once the matching case found, it executes a corresponding block of code. The switch statement is a multiway branch statement that has a different identifier. If the answers don’t match with any of the expressions then it will print the default value. The basic syntax of a switch case is given below:
Syntax
switch (condition)
{
case value1:
block 1;
break;
case value2:
block 2;
break;
....
....
....
default:
default block;
break;
}
Flowchart
Question:- write a program to check a vowel and consonant character.
output
Enter a character (a-z or A - Z): u
u is a vowel character!
0 Comments