0% found this document useful (0 votes)
17 views10 pages

algoritms

The document discusses pseudocode and flowcharts as methods for representing algorithms. Pseudocode uses English-like statements to outline program logic, adhering to syntax and semantics rules, while flowcharts visually depict algorithm logic through symbols and lines. It also covers control structures like sequence, selection, and iteration that dictate the order of instruction execution.

Uploaded by

Oumotia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views10 pages

algoritms

The document discusses pseudocode and flowcharts as methods for representing algorithms. Pseudocode uses English-like statements to outline program logic, adhering to syntax and semantics rules, while flowcharts visually depict algorithm logic through symbols and lines. It also covers control structures like sequence, selection, and iteration that dictate the order of instruction execution.

Uploaded by

Oumotia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ALGORITMS

PSEUDOCODE & FLOWCHARTS


PSEUDOCODE ALGORITHM

 Pseudocode is another way of representing the logic of a program.


It can be defined as English-like statements used to express the
steps of an algorithm. The prefix ‘pseudo’ means in this context -
resembling or imitating. Pseudocode therefore is intended to
resemble actual program code as best as possible. The idea is that
the pseudocode will, line by line, easily be converted into program
source code for easier and smoother program implementation.
PSEUDOCODE ALGORITHM

All languages have two major component rules – syntax and


semantics. Pseudocode must also then conform to a set of rules,
even more as it mimics artificial language.
 Syntax – rules governing correct use of language, word and
sentence structures, sentence pattern, organization, the
structure of commands, statements, or instructions that are
given to a computer.
 Semantics – refers to the meaning of statements.
PSEUDOCODE ALGORITHM

All languages have two major component rules – syntax and


semantics. Pseudocode must also then conform to a set of rules,
even more as it mimics artificial language.
 Syntax – rules governing correct use of language, word and
sentence structures, sentence pattern, organization, the
structure of commands, statements, or instructions that are
given to a computer.
 Semantics – refers to the meaning of statements.
FLOW CHARTS

A flowchart is a diagrammatic representation of the logic


of an algorithm using a series of symbols and lines. The
operations to perform arithmetic computations, make
comparisons etc. are shown inside boxes in the flowchart.
The flowchart should be unambiguous, neat and easy to
follow
MAIN SYMBOLS USE IN FLOW CHARTS

Start/stop

Decision

Input/ Output

Process

Flow line
EXAMPLES OF FLOWCHART

Algorithm: start
 Using pseudocode Product_of_two_numbers
and flowchart, START
Declare num1, num2, product as
Read num1,
design a program integer
num2
that accepts two PRINT “Please enter two numbers”
READ num1, num2
numbers from the Product = num1 * num2
Product = num1 * num2
Print “ The product of two numbers is:
user, multiplies “, Product
Print Product
them and outputs END

the results to the


Stop
screen.
CONTROL STRUCTURES

These structures govern the order in which instructions are


carried out and specify the flow of control. They are:
 Sequence
 Selection
 Iteration
SEQUENCE

 This represents the ability of the computer to


execute instructions in a step-by-step
sequential or consecutive manner.
SEQUENCE
 Example: Using
pseudocode and
flowchart, design a
program that will accept
a number in meters and
convert and output to
the screen its
corresponding values in
centimeters and
millimeters.

You might also like