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. 

Peripheral Device

Definition:  Any input or output device that connects to the system unit of a computer system.

Examples include : Mouse, Monitor, Keyboard, Printer.

Peripheral devices do not aid in the system unit’s main task , i.e, computing.

 

© 2018  Vedesh Kungebeharry. All rights reserved.

 

Data and Information

Definition: Data are raw facts and statistics that have been gathered as input  for processing.

Definition: The output of data processing is information; i.e the results of data processing.

Example:   The heights of each student in a class can be gathered as data   for analysis. e.g

150, 160, 150, 161 etc.

The data can be  analyzed or processed  to determine the height of the tallest student and the average height of students in the class. The processed values   are called information.

 

© 2018  Vedesh Kungebeharry. All rights reserved

What is hardware?

1448px-Personal_computer,_exploded_6.svg

Image Credit: https://en.wikipedia.org/wiki/Computer_hardware#/media/File:Personal_computer,_exploded_6.svg

Definition: Computer Hardware refers to all the physical components of the computer system.

Hardware refers to all physical components of a computer system including:

  • All internal components to the system Unit (ALU,CU,RAM, Hard Disk Drive)
  • All external components (input, storage and output devices)

In Class Challenge!

Can you list all hardware items from 1 to 16 in the picture above?

(Note: leave out #12)

Copyright  © 2018 Vedesh Kungebeharry. All Rights Reserved.