Iteration – While Loop (Live Class)

This content was recorded and posted on Monday 8th November 2021.

See the video and files below:

Files used in Demonstration: https://drive.google.com/drive/folders/1HqohDwVDXH7KHh0XUmyOvVj814SiKp31?usp=sharing

Notes to students:

1.See the attached video from class for revision if needed.
2.The demonstration files that were created are also attached to this post. (It’s posted individually as “Demo01.Fprg” and “Demo02-Looping (While Loop).fprg“.  Both of these files are packaged together in the zip, “Class Demonstration Files Package.zip

Homework

Follow the example that was demonstrated in class today to :
1. Draw a flowchart which will output the cubes of the first 100 numbers
2. Write the pseudocode for the flowchart above.
3. Required reading for next class:  https://islandclass.org/2020/08/21/repetition-iteration-constructs/

© 2021  Vedesh Kungebeharry. All rights reserved. 

Repetition (Iteration) Constructs

Consider the following example:

Find the sum of 10 numbers provided by the user.

This can be accomplished as follows:

The above solution is very long as well as difficult to understand , manipulate and communicate .

Observe that there were many repeated steps in obtaining input from the user.

The solution can be simplified by looping.

A general looping construct is shown below:

The solution can be simply implemented using looping:

Class Discussion: walk-through of solution is discussed.

This files used in this post can be downloaded here:

https://drive.google.com/drive/folders/1KjNcPQATyqh8quxnRjUDbJOgdzGvUY1P?usp=sharing

Homework:

Create an algorithm which uses repetition to output  the 12 times table from 1 to 12.

Updates

2022-10-6: Added files used in this post.

© 2020  Vedesh Kungebeharry. All rights reserved.