Skip to content

Commit c8f8915

Browse files
authoredSep 16, 2022
Java Program - Character is vowel or consonant
Java Program - Check Character is vowel or consonant
1 parent 3fad8d5 commit c8f8915

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
 

‎Test12_vowel_or_Consonant.java

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.test.Basic_Java_Programs;
2+
3+
import java.util.Scanner;
4+
5+
public class Test12_vowel_or_Consonant
6+
{
7+
public static void main(String[] args)
8+
{
9+
char ch;
10+
11+
System.out.print("Enter Character : ");
12+
13+
Scanner sc = new Scanner(System.in);
14+
15+
ch = sc.next().charAt(0);
16+
17+
if (ch =='a' || ch== 'e' ||ch=='i' || ch=='o' || ch=='u')
18+
{
19+
System.out.println("Vowels");
20+
}
21+
else
22+
{
23+
System.out.println("Consonant");
24+
}
25+
26+
}
27+
28+
}
29+
30+
31+
/* Output:
32+
33+
34+
Enter Character : a
35+
Vowels
36+
37+
38+
39+
40+
41+
*/

0 commit comments

Comments
 (0)
Please sign in to comment.