Hello everyone!
I need to understand how to print the number of vowels or consonants in a sentence only using loops,if,and switches.
I can't use a scanner.
Any advice will be really appreciated.
1 Replies - 490 Views - Last Post: 07 July 2012 - 02:52 PM
#1
How to print the number of vowels or consonants in a sentence.
Posted 07 July 2012 - 02:24 PM
Replies To: How to print the number of vowels or consonants in a sentence.
#2
Re: How to print the number of vowels or consonants in a sentence.
Posted 07 July 2012 - 02:52 PM
If you have the sentence as a string, you do it by iterating over the string character by character (using the charAt method in a for-loop) and increasing a different counter at each iteration depending on whether the current character is a vowel or a consonant.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|