Flowcharts – Sequence

Sequential instructions refer to groups of instructions which follow a strict order.  We can observe this by example:

Task: Create a program which prompts the user to enter two numbers.  The program must out put the  sum of the two numbers.

Solution in narrative form:

Prompt the user to enter the first number and accept the data.  Prompt the user to enter a second number and accept the data.  Calculate the sum. Output the sum to the user

Solution in Flowchart:

Notes/observations

  • Notice that to accomplish this task all steps are followed in sequence.
  • Variables are used as containers to store data input from the user and to store the results of processing for output. E.g num1, num2 for input storage, and result for storage and output.
  • the box which contains result <–num1+num2 can be interpreted as “adding the contents of num1 to num2 and then storing the value that was produced by processing in result
  • the line result <–num1+num2 can also be written as result = num1+num2

See the solution in flowgorithm below:

You can download the flowgorithm solution here:

https://drive.google.com/file/d/1s_QRRC-kx6Q-8NA3C__42xCn_-CpumA2/view?usp=sharing

Homework: Draw a flowcharts which accomplish the following tasks

1. Prompt the user to enter 3 numbers and output the sum

2. Prompt the user the enter 2 numbers and output the product

3 Prompt the user to enter 2 numbers and outputs the quotient (first number divided by the second number.) . What happens if the user enters the first number as 5 and the second number as 0 ?

Update

Updated on 18/11/2021 to include section “Notes observations” and 3 additional observations other than the first listed item.

© 2020  Vedesh Kungebeharry. All rights reserved. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s