0% found this document useful (0 votes)
12 views26 pages

Chapter 4 Flowcharts DR Hala

Uploaded by

Magd O.
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)
12 views26 pages

Chapter 4 Flowcharts DR Hala

Uploaded by

Magd O.
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/ 26

Chapter 4

Flowcharts
Algorithms

• The word “algorithm” relates to the name of the


mathematician Al- Khwarizmi, which means a
procedure or a technique.
• Software Engineer commonly uses an algorithm for
planning and solving the problems.
• An algorithm is a sequence of steps to solve a
particular problem
Algorithms

Advantages of using Algorithms


• It is a step-wise representation of a solution to a given problem.
• An algorithm uses a definite procedure.
• It is not dependent on any programming language, so it is easy to
understand for anyone even without programming knowledge.
• Every step in an algorithm has its own logical sequence so it is easy to
debug.
• By using algorithm, the problem is broken down into smaller pieces or
steps hence, it is easier for programmer to convert it into an actual
program
Algorithms

An algorithm should possess the following characteristics:


• Each and every instruction should be precise and clear
• Each instruction should be performed a finite number of times
• The algorithm should ultimately terminate
• When the algorithm terminates the desired result should be obtained.
Algorithms

Expressing algorithms
Algorithms can be expressed in many kinds of notation, including natural
languages, pseudocode, flowcharts, and programming languages.
Natural language expressions of algorithms tend to be verbose and
ambiguous, and are rarely used for complex or technical algorithms.
Pseudocode and flowcharts are structured ways to express algorithms that
avoid many of the ambiguities common in natural language statements,
while remaining independent of a particular implementation language.
Programming languages are primarily intended for expressing algorithms in
a form that can be executed by a computer but are often used as a way to
define or document algorithms.
Algorithms
Algorithms
Flowchart

• A flowchart is “a graphical representation of sequence of


steps to solve a Problem”.
• A flowchart can be developed for practically any job.
• Flowcharting is a tool that can help us to develop and
represent graphically program logic sequence.
• It also enables us to trace and detect any logical or other
errors before the programs are written.
Advantages of using flowcharts

• Flowchart is an excellent way of communicating the logic of a


program.
• Easy and efficient to analyze problem using flowchart.
• During program development cycle, the flowchart plays the role of a
blueprint makes program development process easier.
• The flowchart makes program or system maintenance easier.
• It is easy to convert the flowchart into any programming language
code.
Flowchart Symbols
Flowchart Symbols
Developing Flowcharts

• In developing the flowcharts following points have to be considered:


• Defining the problem.
• Identify the various steps required to form a solution.
• Determine the required input and output parameters.
• Get expected input data values and output result.
• Determine the various computations and decisions involved.
General Rules for flowcharting

• General Rules for flowcharting


1. All boxes of the flowchart are connected with Arrows. (Not lines)
2. Flowchart symbols have an entry point on the top of the symbol with no other
entry points. The exit point for all flowchart symbols is on the bottom except for
the Decision symbol.
3. The Decision symbol has two exit points; these can be on the sides or the bottom
and one side.
4. Generally, a flowchart will flow from top to bottom. However, an upward flow can
be shown as long as it does not exceed 3 symbols.
5. Connectors are used to connect breaks in the flowchart. Examples are:
• From one page to another page.
• From the bottom of the page to the top of the same page.
6. All flowcharts end with a terminal or a contentious loop.
Basic Control Structures
Sequence control structures

Sequence control structures refers


to line-by-line execution, in which
statements are executed
sequentially, in the same order in
which the execution takes place
starting from up to down.
Basic Control Structures
Decision control structures

In decision control, there is a


condition and according to a
condition, a decision of either
TRUE or FALSE is achieved. In the
case of TRUE, one of the two
branches are explored; but in the
case of FALSE condition, the
other alternative is taken.
Basic Control Structures
Loop control structures

The Loop or Repetition allows a


statement(s) to be executed
multiple times until specified
condition is met e.g. WHILE,
FOR loops.
Developing Flowcharts
Problem 1: Draw a flowchart to add two numbers entered by user.
Developing Flowcharts
Problem 2: Draw a flowchart to calculate the perimeter and the area of rectangle.
Developing Flowcharts
Problem 3: Draw a flowchart to enter two numbers and output the larger number.
Developing Flowcharts
Problem 4: Draw a flowchart to get number from user and finds if it is divisible by 7.
Developing Flowcharts
Problem 5: Draw a flowchart to get number from user and finds if it is an even number.
Developing Flowcharts
Problem 6: Draw a flowchart to print all integer numbers that are divisible by 7 in the range 1 to 100.
Developing Flowcharts
Problem 7
• Draw a flowchart to convert student’s exam degrees to their
corresponding grade, where the grading scale is:
Developing Flowcharts
Problem 7
Developing Flowcharts
Problem 8 : Draw a flow chart to Print Hello World 10 times.

You might also like