Lesson 7: Increasing Counted Loops
What are the processes the computer carries out when the following for loop (counted loop) is executed?
var firstInteger: int var lastInteger: int firstInteger: 2 lastInteger: 20 for occurance: firstInteger .. lastInteger put occurance end for
Code a program which prompts the user for their favourite number for nine times. Display their opposite. Hint: Use a for loop.
Project Three
Your name is?
Code a program which prompts the user for their first name and output it seven times. Extra: prompt the user to specify the ending value, in other words, the number of times the name should be outputted.
Multiply!
Code a program which prompts the user for which multiplication table (1 to 15) to output. After which, clear the screen and neatly display the equation, for instance, consider the following output after the clear screen procedure is used:
5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 ... 5 x 15 = 75
Extra: modify the above program so that the user sets the beginning and end of the specified table. In example, the user may specify 4 as their desired table. After which, the user will be prompted for a starting value (second factor in the first equation) followed by a prompt for an ending value (second factor in the last equation). If his inputs are 4, 2, 5 respectively, the output after the clear screen will appear as the following:
4 x 2 = 8 4 x 3 = 12 4 x 4 = 16 4 x 5 = 20