-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVowel.java
More file actions
25 lines (23 loc) · 875 Bytes
/
Copy pathVowel.java
File metadata and controls
25 lines (23 loc) · 875 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
import java.util.*;;
public class Vowel {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("ENter a String");
String str = sc.nextLine();
int i, n = str.length();
int vowel = 0, conso = 0;
for (i = 0; i < n; i++) {
if (str.charAt(i) == 'A' || str.charAt(i) == 'E' || str.charAt(i) == 'I' || str.charAt(i) == 'O'
|| str.charAt(i) == 'U' ||
str.charAt(i) == 'a' || str.charAt(i) == 'e' || str.charAt(i) == 'i' || str.charAt(i) == 'o'
|| str.charAt(i) == 'u') {
vowel++;
} else {
conso++;
}
}
System.out.println("Vowel =" + vowel);
System.out.println("Conso =" + conso);
sc.close();
}
}