-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveVowel.java
More file actions
27 lines (24 loc) · 953 Bytes
/
Copy pathRemoveVowel.java
File metadata and controls
27 lines (24 loc) · 953 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 RemoveVowel {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter any phrase: ");
String phrase = scanner.nextLine();
StringBuilder result = new StringBuilder();
// Iterating to each letter of the phrase:
for (int i = 0; i < phrase.length(); i++) {
char eL = phrase.charAt(i);
// check each letter is vowel or not:
if (eL == 'a' || eL == 'A' || eL == 'e' || eL == 'E' ||
eL == 'i' || eL == 'I' || eL == 'o' || eL == 'O' || eL == 'u' || eL == 'U') {
continue; // skip this block
}
// append the remaining letter:
else {
result = result.append(eL);
}
}
// display the constant only:
System.out.println(result);
}
}