-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractical_06.java
More file actions
30 lines (27 loc) · 871 Bytes
/
Practical_06.java
File metadata and controls
30 lines (27 loc) · 871 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
/* Question := Write a program that prompts the user to enter a letter and check whether a letter
is a vowel or consonant.*/
import java.util.Scanner;
public class Practical_06 {
static void checkVowel(int x) {
if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') {
System.out.println("Vowel");
}
else if (x == 'A' || x == 'E' || x == 'I' || x == 'O' || x == 'U'){
System.out.println("Vowel");
}
else {
System.out.println("Consonant");
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a Letter := ");
char x = sc.next().charAt(0);
checkVowel(x);
}
}
/* Output :=
Enter a Letter :=
d
Consonant
*/