
WRITE A PROGRAM THAT WILL INPUT A WORD THEN IT WILL DETERMINE THE NUMBER OF VOWELS PRESENT IN THE INPUTTED WORD

Hi Friend,
Try the following code:
import java.util.*;
class CountVowels{
public static void main(String args[]){
Scanner input=new Scanner(System.in);
System.out.println("Enter Word:");
String st = input.nextLine();
int count = 0;
for (int i = 0; i < st.length(); i++) {
char c = st.charAt(i);
if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
count++;
}
}
System.out.println("There are" + " " + count + " " + "vowels in a word");
}
}
Thanks