import java.util.Scanner;
public class VowelChecker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a string: ");
String input = scanner.nextLine();
if (containsVowel(input)) {
System.out.println("The string contains at least one vowel.");
} else {
System.out.println("The string does not contain any vowel.");
}
scanner.close();
}
public static boolean containsVowel(String str) {
str = str.toLowerCase(); // Convert the string to lowercase for case-insensitive comparison
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
return true; // Return true if a vowel is found
}
}
return false; // No vowel was found in the string
}
}
(code-box)🚀 Elevate Your Career with Studyecart! 📚📊
🔥 Get instant job notifications and ace interviews with Studyecart. 📌
#StudyecartApp #CareerBoost
