Download Introduction to Computers and Programming∗

Transcript
OpenStax-CNX module: m27277
12
Input the three values into the variables Name, Hours, Rate.
Calculate Pay = Hours [U+F0B4] Rate.
Display Name and Pay.
4.3 Loops in Algorithms
Many problems require repetition capability, in which the same calculation or sequence of instructions is
repeated, over and over, using dierent sets of data.
Example 1.1.
Write a program to do the task: Print a list of the numbers from 4 to 9, next to each
number, print the square of the number.
The owchart for the algorithm that solves this problem is given in Figure below. You will see in this
gure the owchart symbol for decision and the owline that can connect backward to represent a loop.
http://cnx.org/content/m27277/1.1/