Count vowels in char array
Java
Easy
5 views
Problem Description
Task: return count of vowels (a,e,i,o,u) in given char array (lowercase).
Output Format
Return value
Constraints
Assume lowercase letters.
Official Solution
static int countVowels(char[] s){int c=0;for(char ch:s){if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u') c++;}return c;}
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!