Supplemental Looping Practice Problems



1.  For each person on the 49ers starting team, enter the number of points he scored this season.  If he scored more than 20 points print "HERO" Otherwise print "STAR"


2.  Ask the user to enter 5 numbers between 1 and 12.  For each number, print it on a separate line, then multiply it by three until the result is greater than 100.  For example, with inputs of 7,4,6,11,3 the output would be:
? 7
    7    21    63    189
? 4
    4    12    36    108
? 6
    6    18    54    162
? 11
    11    33    99    297
? 3
    3    9    27    81    243

3.  For each number from 1 to 100, divide the number by 7.  If the remainder is zero, print the number.  (Print the numbers between 1 and 100 that are evenly divisible by 7).

4.  Given a list of classes and grades from your report card;  Read each grade and if the grade is an A, add one to a total.  (Count the number of A's on your report card.)


5.  For each number from 1 to 100, isolate the last digit.  If the digit is a 7, print the number.  (Print numbers between 1 and 100 that end in 7).


6.  Ask the user to enter 5 numbers.  For each number print it on a separate line followed by a "countdown" to zero.  For example, with input of 6,3,7,4,3, the output would be:
    6    5 4 3 2 1 0
    3    2 1 0
    7    6 5 4 3 2 1 0
    4    3 2 1 0
    3    2 1 0


7.  Given a list of scores for people who played Centipede;  Read each score, and if the score is greater than the highest so far, make the score be the highest.  (Find the highest score in a list of Centipede scores.)


8.  Ask the user to enter a number.  Print each digit of the number on a separate line, followed by that many stars.  For example, with input of 624, the output would be:
        4 * * * *
        2 * *
        6 * * * * * *