Topic of Presentation
Algorithm
&
Flow Chart
Class 10th computers
Presented by
Anees Ahmed Awan
Roll No. BC180400258
Department of Education
Virtual University of Pakistan
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
Algorithms
An algorithm is a finite set of steps defining the solution of a particular
problem.
Need not to belong one particular language
Sequence of English statements can also be algorithm
It is not a computer program
An algorithm can be expressed in English like languages
Its can also be expressed in the form of flowchart.
Example
Write an algorithm to determine a student’s final grade
and indicate whether it is passing or failing. The final
grade is calculated as the average of four marks.
Detailed Algorithm
Step 1: Input M1,M2,M3,M4
Step 2: GRADE (M1+M2+M3+M4)/4
Step 3: if (GRADE < 50) then
Print “FAIL”
else
Print “PASS”
End
Computer Program ?
Set of instructions to perform some specific task
Code: refers to statements that are written in any programming
language as machine code or C code.
Code is some time interchangeably used with program
Is Program itself a Software ?
Algorithm Vs Program
What is the difference between an algorithm and a program?
A program is an implementation of an algorithm to
be run on a specific computer and operating system.
An algorithm is more abstract it does not deal with
machine specific details think of it as a method to
solve a problem.
Algorithm Specification
Every algorithm must satisfy the following criteria :
Input. Zero or more quantities are externally supplied.
Output. At least one quantity is produced.
Definiteness. Each instruction must be clear and
unambiguous(Unique meaning).
Finiteness. An algorithm terminates in a finite number of steps.
Effectiveness. Every instruction must be basic enough to be
carried out than, means not so complex.
Flowchart
A Flowchart is a graphical or symbolic
representation of a problem in the sequence of
operations
It shows logic of an algorithm
It emphasizes individual steps and their
interconnections
e.g. control flow from one action to the next
Flow Chart Symbols
EXAMPLE 1
Write an algorithm to determine a student’s final
grade and indicate whether it is passing or failing.
The final grade is calculated as the average of four
marks.
EXAMPLE 2
Write an algorithm and draw a flowchart to convert the
length in feet to centimeter.
Any Question ?
Home Work Assignment
Write an algorithm to make a tea also
Draw Flow chart of that Algorithm.
E-mail ID for Assignment submission: anees.awan70@gmaill.com
Thanks