-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVowelsAndConsonants.java
More file actions
52 lines (20 loc) · 876 Bytes
/
Copy pathVowelsAndConsonants.java
File metadata and controls
52 lines (20 loc) · 876 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
import java.util.Scanner;
public class VowelsAndConsonants{
public static void main(String...args){
Scanner input = new Scanner(System.in);
System.out.println("Enter characters :");
String characters = input.nextLine();
int vowelCounter = 0;
int consonants = 0;
for(int count = 0; count < characters.length();count++){
char alphabets = characters.charAt(count);
if(alphabets == 'a' || alphabets == 'A' || alphabets == 'e' || alphabets == 'E'|| alphabets == 'i' ||alphabets == 'I' || alphabets == 'o'|| alphabets == 'O'|| alphabets == 'U' || alphabets == 'u'){
vowelCounter ++;
}else{
consonants++;
}
}
System.out.println("Number of consonant is "+consonants);
System.out.println("Number of vowels is "+(VowelCounter);
}
}