0% found this document useful (0 votes)
23 views

Algorithms and Flowcharts: Presented by

This document discusses algorithms and flowcharts. It defines an algorithm as a finite set of steps to solve a problem and notes the typical phases of problem solving and implementation. It also outlines the components of algorithms including inputs, outputs, definiteness, and finiteness. The document then provides examples of algorithms and uses flowcharts to visualize the logic and control flow. It explains flowchart symbols and provides an example flowchart for a simple algorithm to add three numbers. Finally, it discusses decision structures using relational operators and if-then-else logic.

Uploaded by

Manjari Agrawal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Algorithms and Flowcharts: Presented by

This document discusses algorithms and flowcharts. It defines an algorithm as a finite set of steps to solve a problem and notes the typical phases of problem solving and implementation. It also outlines the components of algorithms including inputs, outputs, definiteness, and finiteness. The document then provides examples of algorithms and uses flowcharts to visualize the logic and control flow. It explains flowchart symbols and provides an example flowchart for a simple algorithm to add three numbers. Finally, it discusses decision structures using relational operators and if-then-else logic.

Uploaded by

Manjari Agrawal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 16

ALGORITHMS AND

FLOWCHARTS

PRESENTED BY:
MANJARI AGRAWAL
HIMANI ARORA
GEETA JAGWANI
ALGORITHMS AND FLOWCHARTS
 A typical programming task can be divided into
two phases:
 Problem solving phase
 produce an ordered sequence of steps that describe
solution of problem
 this sequence of steps is called an algorithm

 Implementation phase
 implement the program in some programming
language
Steps in Problem Solving
 An algorithm is a finite set of instructions that, if
followed, accomplishes a particular task. In addition,
all algorithms must satisfy the following criteria:
 Input: zero or more quantities are externally supplied.
 Output: at least one quantity is produced.
 Definiteness: each is instruction is clear and
unambiguous.
 Finiteness: the algorithm terminates after a finite number
of steps.
 Effectiveness: each in instruction must be very basic.
Algorithm
 Example 1: A program is required to read
three numbers, add them together and print
their total.
Algorithm
 Detailed Algorithm
 Step 1: Input M1,M2,M3
Step 2: GRADE  M1+M2+M3
Step 3: Print GRADE
The Flowchart

A Flowchart
 shows logic of an algorithm
 emphasizes individual steps and their
interconnections
 e.g. control flow from one action to the next
Flowchart Symbols
Basic
Name Symbol Use in Flowchart

Oval Denotes the beginning or end of the program

Parallelogram Denotes an input operation

Rectangle Denotes a process to be carried out


e.g. addition, subtraction, division etc.

Diamond Denotes a decision (or branch) to be made.


The program should continue along one of
two routes. (e.g. IF/THEN/ELSE)

Hybrid Denotes an output operation

Flow line Denotes the direction of logic flow in the program


Start Example
Read Step 1: Input M1,M2,M3
Number1 Step 2: GRADE  M1+M2+M3
Number2 Step 3: Print GRADE
number3

Add numbers to total

Print total

Stop
DECISION STRUCTURES
 The expression A>B is a logical expression
 it describes a condition we want to test
 if A>B is true (if A is greater than B) we take
the action on left
 print the value of A
 if A>B is false (if A is not greater than B) we
take the action on right
 print the value of B
DECISION STRUCTURES

Y N
is
A>B

Print Print
A B
IF–THEN–ELSE STRUCTURE
 The structure is as follows
If condition then
true alternative
else
false alternative
end if
IF–THEN–ELSE STRUCTURE
 The algorithm for the flowchart is as
follows:
If A>B then
Y N
print A is
A>B
else
print B Print
A
Print
B
end if
Relational Operators

Relational Operators
Operator Description
> Greater than
< Less than
= Equal to
 Greater than or equal to
 Less than or equal to
 Not equal to
Example 2
 Write an algorithm that reads two values, determines the
largest value and prints the largest value with an
identifying message.
ALGORITHM
Step 1: Input VALUE1, VALUE2
Step 2: if (VALUE1 > VALUE2) then
MAX  VALUE1
else
MAX  VALUE2
end if
Step 3: Print “The largest value is”, MAX
Example 2
START

Input
VALUE1,VALUE2

Y is N
VALUE1>VALUE2

MAX  VALUE1 MAX  VALUE2

Print
“The largest value is”,
MAX

STOP

You might also like