Skip to content

Commit 317b3e3

Browse files
Vowel And Consonent
Vowel And Consonent Co-Authored-By: Manish Upadhyay <ermanishupadhyay@gmail.com>
1 parent 8a9659c commit 317b3e3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package JavaPrograms;
2+
3+
public class VowelAndConsonent {
4+
5+
public static void main(String[] args) {
6+
7+
// vowel are : a e i o u
8+
char ch = 'm';
9+
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
10+
System.out.println(ch + " is vowel");
11+
}
12+
else {
13+
System.out.println(ch + " is consonent");
14+
}
15+
16+
// 2nd way, we can use switch case
17+
char chrc = 'u';
18+
switch (chrc) {
19+
case 'a':
20+
case 'e':
21+
case 'i':
22+
case 'o':
23+
case 'u':
24+
25+
System.out.println(chrc + " is vowel");
26+
break;
27+
28+
default:
29+
System.out.println(chrc + " is consonent");
30+
break;
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)