-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay1.java
More file actions
53 lines (34 loc) · 844 Bytes
/
Day1.java
File metadata and controls
53 lines (34 loc) · 844 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
Day 1 coding Statement: Write a program to identify if the character is a vowel or consonant.
Description of the program:
Take an input character from the user and check whether the given input is a vowel or consonant.
Input
A
Output
Vowel
Input
m
Output
Consonant
Input
3
Output
Invalid Input
*/
import java.util.*;
class Day1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter a character : ");
char ch=sc.next().charAt(0);
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')){
if(ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I'||ch=='o'||ch=='O'||ch=='u'||ch=='U'){
System.out.println("Vowel");
}else{
System.out.println("Consonant");
}
}else{
System.out.println("Invalid");
}
}
}