Created
December 6, 2012 21:37
-
-
Save abloom/4228708 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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