Lecture 2- Algorithms and Flowchart
Lecture 2- Algorithms and Flowchart
and Technology
Presented by
Dr. May
Algorithms and Flowchart
Presented by
Dr. May
Purpose of This Lecture
• This lecture reviews an introduction to Algorithms and flowchart.
Lecture Outline
• Introduction
• Algorithms
• Flowchart
• Summary
Introduction
• A program is a set of instruction gave to the computer to execute
successive operations leads to solve specific problem.
• Algorithms and flowchart are two different ways to solve problems.
• In general to solve any problem in computer we must follow these
steps:
1. Analyze the problem
2. Write an Algorithm
3. Draw flowchart
4. Convert the flowchart to program
5. Run the program and test the solution
Algorithms
• Algorithms consist of steps for solving a particular problem.
• It is a combination of phrases and events that can be arranged as steps
to solve a specific problem.
• That can be done by understanding this problem whether it
mathematic or logic before convert it to flowchart.
Algorithms
• Example: when we borrow some books from the library, the
remaining books number (NR) is the subtraction of the borrowed
books number (NB) from the original number (NO).
• To write the algorithm for this simple problem we will follow these
steps:
Input the number of books in the library (NO).
Input the number of borrowed books (NB).
Find the remaining books number (NR), NR = NO - NB
Print NR
Flowchart
• Flowcharts are graphs that represent the formal view used to solve any
problem.
• Flowcharts help the programmer to write his program.
• Flowcharts consist of a shapes connected by a straight lines.
• Flow chart can be used for representing an algorithm.
Flowchart – symbols
Input - Condition
Output
Start
Flowchart – examples
Read A A = 50
• 1) Find sum of two numbers.
Read B B = 40
End
Start
Flowchart – examples
Read A, B ,C A=5,B=3,c=2
• 2) Get average of 3 numbers
End
Start