-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVowel.java
More file actions
28 lines (17 loc) · 743 Bytes
/
Copy pathVowel.java
File metadata and controls
28 lines (17 loc) · 743 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.Scanner;
public class Vowel {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a string: ");
String word = scanner.nextLine();
int position = 0;
for (int count = 0; count < word.length(); count++) {
char c = word.charAt(count);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U') {
position = count;
System.out.println("First vowel '" + word.charAt(position) + "' found at position: " + position);
}
}
}
}