ALGORITHM WRITING
FLOWCHART
AND PSEUDO CODE
An Algorithm is a step-by-step
procedure to solve a given problem.
On the other hand, Procedure is a
finite sequence of well-defined instructions, each of which can be carried out
in a finite amount of time.
What is flow-chart? Flow chart is
a type of diagram that represents an algorithm or process.
What is Pseudo-code? A
pseudo-code is a compact and informal high-level description of a program.
Some Flow-chart symbols, Meaning and
implementation
|
Symbols |
Meaning
& Usage |
|
Name: Terminal Meaning:
Indicates the starting or ending of the program. Usage: Used
to Initialize/Start or to
Stop/Terminate a program |
|
|
|
Name: Input/Output Meaning:
Indicates the Input or Output of program Usage: Used
to Indicate the Input (Enter) or Output (Display) a program |
|
|
Name: Process Meaning:
Indicates any type of internal operations. Also called instruction box. Usage: Used
for calculations, operations and can even be used for Initialization or to
Start a program. |
|
|
Name: Decision Meaning:
Indicates any logical operation like Decision making etc Usage: Used
for asking questions that returns True or False and then make
decision based on that. |
|
|
Name: Connector Meaning:
Indicates breaks in the program Usage: Used
to connect breaks in a flowChart |
|
|
Name: Control
Flow Meaning:
Show direction of flow Usage: Used
to indicate the moving of the flowchart |
Flow-chart Rules:
1.
Flowchart is generally
drawn from top to bottom
2.
All boxes of flowchart
must be connected with arrow.
3.
All flowchart start with a
Terminal or process symbol.
4.
Decision symbol have 2
exist points, one for YES (True) and another for NO (False).
Sample of Flow-chart:
Exercises:
Now, try this exercises, we will solve them in the next article.
a.
Develop an Algorithm to
calculate the sum of squares of given input of numbers. Create the flowchart
and pseudo-code of the algorithm above
b.
Develop an algorithm that
reads in three numbers and writes them all in sorted order. Also Create the
flowchart and pseudo-code of the
algorithm above.
c.
Using Algorithm, flowchart
and pseudo code, calculate a running sum: a user will enter numbers that will
be added to the sum and when a negative number is encountered, stop adding
numbers and write out the final result.
Thank You...
To Be Continued...
No comments:
Post a Comment