Answers for "calculate the number of vowels and consonants in a string in java"

0

calculate the number of vowels and consonants in a string in java

for (int k = 0; k < text.length(); k++) {
    char c = text.charAt(k);
    if (c == 'a' || c == 'e' || c == 'i' || 
       c == 'o' || c == 'u') 
              owls += vowls
else
            consonts += consonts
}
System.out.println("Vowel count is " + vowls); 
System.out.println("Consonant count is: " + consonts);
Posted by: Guest on June-29-2021

Code answers related to "calculate the number of vowels and consonants in a string in java"

Browse Popular Code Answers by Language