Difference between revisions of "Count the Alphabet"

From CompSciWiki
Jump to: navigation, search
Line 3: Line 3:
 
|Problem=Loop through the alphabet to count how many consonants and vowels there are.  Print a separate statement for each count.   
 
|Problem=Loop through the alphabet to count how many consonants and vowels there are.  Print a separate statement for each count.   
  
''Remember:'' A [https://wiki1010.cs.umanitoba.ca/mediawiki/index.php/Common_Primitive_Variables#Primitive_Type_char[char]] acts much the same way as an [[int]] does.  You can perform arithmetic with char just like you can with an int.
+
''Remember:'' A [[char]] acts much the same way as an [[int]] does.  You can perform arithmetic with char just like you can with an int.
 
|SideSectionTitle=While and For Loops
 
|SideSectionTitle=While and For Loops
  

Revision as of 10:43, 8 April 2010

Back to the Program-A-Day homepage

Problem

Loop through the alphabet to count how many consonants and vowels there are. Print a separate statement for each count.

Remember: A char acts much the same way as an int does. You can perform arithmetic with char just like you can with an int.

 

While and For Loops

Wiki loops03.jpg

Solution

Code

Solution Code

Back to the Program-A-Day homepage