Skip to content

Instantly share code, notes, and snippets.

@abloom
Created December 6, 2012 21:37
Show Gist options
  • Select an option

  • Save abloom/4228708 to your computer and use it in GitHub Desktop.

Select an option

Save abloom/4228708 to your computer and use it in GitHub Desktop.
public class Vowels {
public static void main(String [ ] args) {
int pIndex, vIndex, count;
char[] vowels = { 'a', 'e', 'i', 'o', 'u' };
String phrase = "phrase";
count = 0;
for(pIndex = 0; pIndex < phrase.length(); pIndex++) {
for(vIndex = 0; vIndex < 5; vIndex++) {
if (phrase.charAt(pIndex) == vowels[vIndex]) {
count++;
break;
}
}
}
System.out.println(count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment