Algorithm Development: by Neil A. Basabe

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Algorithm

Development

by Neil A. Basabe
- procedure for solving a problem in terms of the actions to be executed
and the order in which those actions are to be executed. An algorithm is
merely the sequence of steps taken to solve a problem.

2 Ways To Depict An Algorithm:

a. Pseudocode - is a plain language description of the steps in an algorithm or another system


- often uses structural conventions of a normal programming language,
but is intended for human reading rather than machine reading

b. Flowchart - a type of diagram that represents a workflow or process


- a diagrammatic representation of an algorithm, a step-by-step approach
to solving a task
START/BEGIN: This is the start of your
Steps To Write pseudocode.
Pseudocode INPUT: This is data retrieved from the user
through typing or through an input device.
READ / GET: This is input used when reading
● Capitalize key data from a data file.
commands (IF score PRINT, DISPLAY, WRITE, SHOW: This will show
> 70 THEN...) your output to a screen or the relevant
output device.
● Write one statement COMPUTE, CALCULATE, DETERMINE: This is
per line used to calculate the result of an
expression.
● Use indentation SET, INIT: To initialize values.
INCREMENT, BUMP: To increase the value of a
● Be specific variable.
DECREMENT: To reduce the value of a variable.
● Keep it simple STOP/END: The end of the pseudocode.
Example 1: Write a pseudo code for a program that prompts
the user to input two numbers. Thereafter, the
program will display the product of the the two
numbers.

BEGIN
SET product = 0
INPUT num1 , num2
CALCULATE product = num1*num2
WRITE product
END

Pseudocode Example
- is a diagram that uses a set of standard graphic symbols to
represent the sequence of coded instructions fed into a computer, enabling it to perform
specified logical and arithmetical operations.

Flowchart
Example 1: Using a flowchart, develop an algorithm of a program that prompts the user
to input 4 Major Exams. Thereafter, the program will display “PASS” if average grade is
greater than or equal to 60 otherwise, it will display “FAIL”.

You might also like