Grade 8
Pseudocode and Flowcharts
Q1. Explain algorithm, pseudocode and flowchart
Algorithm
An algorithm is step by step method of solving a problem. This is usually shown as a
flowchart or pseudocode.
Pseudocode
This is a simple way of describing an algorithm (or program) using English-like words
and mathematical operators .It iis often easier to write, and more understandable, since it
is close to English.
Flowcharts
A graphical (picture) representation of the sequence of operations in a program is called
flowchart. Flowcharts are an effective way to communicate the algorithm that shows how
a system or sub-system works. In this technique, operations are represented by drawing
the appropriate geometrical shapes.
Basic Flowchart Symbols and Meaning
Symbol Meaning
Rounded rectangle or oval shape denotes the beginning or end of the
Start/End program.
Parallelogram denotes either an input operation (eg. Input name or read
Input/output number) or output operation (eg. Print name).
Rectangle shape denotes process to be carried out.
Process Eg: addition, subtraction, division etc
Flow line
Arrow denotes direction of logic flow in a program.
Diamond shape denotes the decision to be made(eg.If…then…else)
Decision
Circle denotes continuity of flowchart in another place or page.
Connector
1
1. Write an algorithm, using pseudocode and a flowchart to inputs two numbers and find sum of
these numbers.
Flowchart Pseudocode
START
INPUT A,B
Total=A+B
INPUT A,B PRINT Total
Total =A+B
PRINT Total
STOP
2.Write an algorithm, using pseudocode and a flowchart to determine a student’s final marks and
indicate whether it is passing or failing. The final mark is calculated as the sum of three marks.
START
Pseudocode
INPUT M1,M2, M3 INPUT M1, M2, M3
TOTAL =M1+M2+M3
IF TOTAL > 50 THEN
PRINT “Passed”
TOTAL=M1+M2+M3 ELSE
PRINT “Failed”
END IF
Yes IS TOTAL>50 No
GRA
Passed Failed
STOP
2
Pseudocode
READ A,B
IF (A> B ) THEN
PRINT A
ELSE
PRINT B
END IF
LOOP STRUCTURE OR ITERATION
Loop is an action which is repeated again and again depending upon a condition test.
1. Flowchart to print the word “WELCOME” in 10 times
Algorithm:
1. Enter X= Welcome (Process)
2 Initialise count=1
3. Print Welcome
4. Is count is less than or equal to 50 then
increment count by 1and go to step 3 else
stop.to 50 (decision) then increment
count by 1and go to step 3 else stop.
3
2. Flowchart to find average of 5numbers. Complete the trace table for this flowchart using
the following input numbers.
7, 10, 5, 1, 2
3. Trace the flow chart using the numbers 2 and 3. Write down the each of the values of N in the
order they are printed out.
a)2……………………………………………………………………………………………
b)3 …………………………………………………………………………………………..
4
4.Study the following flowchart very carefully
Complete the trace table for the input value of 5