Skip to content

Commit f17a9a6

Browse files
committed
Added Practice Program.
Signed-off-by: Someshdiwan <[email protected]>
1 parent a01f31c commit f17a9a6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* Write a program that takes a lowercase English alphabet character as input and uses a 'switch' statement to
2+
determine if it's a Vowel or Consonant. */
3+
4+
import java.util.Scanner;
5+
6+
class SwitchCodeCC {
7+
public static void main(String[] args) {
8+
Scanner scanner = new Scanner(System.in);
9+
char ch = scanner.next().charAt(0);
10+
11+
switch (ch) {
12+
case 'a':
13+
System.out.println("Vowel");
14+
break;
15+
case 'e':
16+
System.out.println("Vowel");
17+
break;
18+
case 'i':
19+
System.out.println("Vowel");
20+
break;
21+
case 'o':
22+
System.out.println("Vowel");
23+
break;
24+
case 'u':
25+
System.out.println("Vowel");
26+
break;
27+
default:
28+
System.out.println("Consonant");
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)