



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























Terminal: Used to indicates the start and end of a flowchart. Single flow line. Only one “Start” and “Stop” terminal for each program. The end terminal for function/subroutine must use “Return” instead of “Stop”. Process: Used whenever data is being manipulated. One flow line enters and one flow line exits. Input/Output: Used whenever data is entered (input) or displayed (output). One flow line enters and one flow line exits.
Linear Flow Chart Decision Statements
F unction Page 1 Page 2 End terminal must be a “Return” Start terminal for a Function is different. Do not use “Start” The detail of how the function works is put in another flowchart. This is known as Function-Definition At this point, we only focus on what to do. How to do it, it comes later. This part is known as Function-Call Body of a function is the same with normal flowchart This flowchart calculates the average of three numbers AVRG (result, n1, n2,n3) Start Stop Read n1, n2 , n Print result AVRG ( result,n1, n2,n3) Return sum = n1+ n2+n result = sum/
Connectors on the same page 1- connection on the same flowchart portion 2- connection on the different flowchart portion Start 2 1 (^1 ) Stop
Example: Input: Length <- 5 Width <- 3 Process: Area = 5 * 3 = 15 Process: Perimeter = 2* (5+3) = 16 Output Area: 15 Perimeter: 16 Start Stop Read Length, Width Print Area, Perimeter Calculate Area Area=Length * Width Calculate Perimeter Perimeter= 2 * (Width+Length)
Binary Selection In pseudocode , binary selection is expressed in the following ways:
Repetition Repetition allows for a portion of an algorithm or computer program to be done any number of times dependent on some condition being met. An occurrence of repetition is usually known as a loop. An essential feature of repetition is that each loop has a termination condition to stop the repetition, or the obvious outcome is that the loop never completes execution ( an infinite loop ). The termination condition can be checked or tested
Repetition
Repetition: Pre-Test A pre-tested loop is so named because the condition has to be met at the very beginning of the loop or the body of the loop is not executed. This construct is often called a guarded loop. The body of the loop is executed repeatedly while the termination condition is true.
In pseudocode , pre-test repetition is expressed as: WHILE condition is true process(es) ENDWHILE Repetition In flowcharting pre-test repetition is expressed as: