
plzz sent me d code for counting vowels in a string... gui programme.......

Hi Friend,
Try this:
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
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.