-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweek4a.java
More file actions
27 lines (26 loc) · 938 Bytes
/
week4a.java
File metadata and controls
27 lines (26 loc) · 938 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
import java.util.Locale;
import java.util.Scanner;
public class week4a {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Size of the Array :");
int n = sc.nextInt();
String[] a = new String[n];
for (int i = 0; i < n; i++) {
System.out.print("Enter the " + (i + 1) + "th String :");
a[i] = sc.next();
}
for (int i = 0; i < n; i++) {
String b = a[i].toLowerCase();
int count = 0;
for (int j = 0; j < b.length(); j++) {
char c = b.charAt(j);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
count += 1;
}
}
System.out.println("Number of Vowels = " + count);
System.out.println("Number of Consonants = " + (b.length() - count));
}
}
}