-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVowels 1
More file actions
32 lines (31 loc) · 673 Bytes
/
Vowels 1
File metadata and controls
32 lines (31 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//WAP to check if the entered character is a vowel or consonant.
import java.util.Scanner;
class Hw
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter any character: ");
char c=sc.next().charAt(0);
if ((c>='a'&& c<='z')||(c>='A' && c<='Z'))
{
switch (c)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U': System.out.println("The entered character is a Vowel!");
break;
default: System.out.println("The entered character is a Consonant!");
}
}
else
System.out.println("You did not enter a Charater!!!");
}
}