flowcharting and algorithm

23
Zeinna Belle C. Desamito Melissa Mae B. Ibarra 9-SSC-Lavoisier and

Upload: zeinna-belle-desamito

Post on 19-Jul-2015

197 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Flowcharting and Algorithm

Zeinna Belle C. Desamito

Melissa Mae B. Ibarra

9-SSC-Lavoisier

and

Page 2: Flowcharting and Algorithm

A computer is a useful tool for solving agreat variety of problems. To make a computerdo anything, you have to write a computerprogram. In a computer you tell a computer,step by step, exactly what you want it do. Thecomputer then executes the program, followingeach step mechanically, to accomplish the endgoal.

Page 3: Flowcharting and Algorithm

Look around you. Computers and networks areeverywhere. In mathematics and computer science analgorithm is a finite sequence of step expressed forsolving a problem. An algorithm can be defined as “aprocess that performs some sequence of operation inorder to solve a given problem”. Algorithms are used forcalculation, data processing and many other fields. Agood algorithm is like using the right tool in theworkshop. It does the job with the right amount ofeffort.

Page 4: Flowcharting and Algorithm

Algorithms can be expressed in many different notations,including pseudocode, flowchart and programming languages.Pseudocode and flowcharts are structured ways to expressalgorithms. Programming languages are primarily intended forexpressing algorithms in a form that can be executed by a computer,but are often used to define or document algorithms. Sometimes it ishelpful in the description of an algorithm to supplement smallflowcharts with natural language and/or arithmetic expressionswritten inside block diagrams to summarize what the flowcharts areaccomplishing.

Page 5: Flowcharting and Algorithm

The use of algorithm provides a number ofbenefits. By using an algorithm, decision makingbecomes more rational. Problems that would bedifficult to solve in entirely can be answered easilyas small series. An algorithm serves as a mnemonicdevice and helps ensure that variables or parts ofthe problem are not ignored.

Page 6: Flowcharting and Algorithm

A flowchart is a type of diagram (graphical or symbolic) thatrepresents an algorithm or process. Each step in process isrepresented by a different symbol and contains a short descriptionof the process step.

A flowchart describes what operations are required to solvea given problem.

Flowcharts are used in analyzing, designing, documenting,or managing a process or program in various fields.

Page 7: Flowcharting and Algorithm

To communicate with others how a process is done.

A flowchart is generally used when a new project begins in

order to plan for the project.

A flowchart helps to clarify how things are currently working

and how they could be improved.

Flowcharts also uncover steps that are redundant or

misplaced.

Page 8: Flowcharting and Algorithm

Picture Shape Name ActionRepresented

Oval Terminal Symbol Represents startand end of program

Parallelogram Input/Output Indicates input and output

Page 9: Flowcharting and Algorithm

Rectangle Process This representsprocessing of action.e.g. mathematical operator

Diamond Decision Since computer only answer the question yes/no, this is used to represent logical test for the program.

Hexagon Initialization/Preparation

This is used to preparememory for repetition of an action.

Arrow Lines & ArrowHeads

Direction This shows the flow of the program

Page 10: Flowcharting and Algorithm

Annotation This is used to describe action or variable.

Circle On page connector This is used to show connector or part of program to another part.

Pentagon Off- page connnector This is used to connect part of a program to another part on the other page or paper.

Page 11: Flowcharting and Algorithm

These are the basic symbols used generally.Now, the basic guidelines for drawing a flowchartwith the above symbols are that:

In drawing a proper flowchart, all necessary requirements

should be listed out in logical order.

The flowchart is to be read left to right or top to bottom.

A process symbol can have only one flow line coming out of it.

For a decision symbol, only one flow line can enter it, but

multiple lines can leave it to denote possible answers.

The terminal symbols can only have one flow line in

conjunction with them.

Page 12: Flowcharting and Algorithm

Sequence of a Flowchart

Page 13: Flowcharting and Algorithm
Page 14: Flowcharting and Algorithm

• Design a flowchart that will accept and display a number. Write its equivalent algorithms.

Page 15: Flowcharting and Algorithm

Algorithm:

Step 1. Read in the value of N.

Step 2. Print the value of N.

START

Read N

Print N

END

Page 16: Flowcharting and Algorithm

• Construct a flowchart that will compute andprint the sum of and average of 3 numbers.Write each equivalent algorithm.

Page 17: Flowcharting and Algorithm

Algorithm:

Step 1: Inizialization of the sum and average into 0.

Step 2: Input a,b,cStep 3: Compute sum by adding a,b, and c then compute the average by dividing the sum of a,b and c by 3

Step 4: Print the computed sum and average

START

SUM=0

READ A,B, C

Print Sum, Average

ENDSUM= A+B+CAVERAGE = (A+B+C)/3

Page 18: Flowcharting and Algorithm

•Draw a flowchart that computes and prints the area of a rectangle. Write each

equivalent algorithm.

Page 19: Flowcharting and Algorithm

Algorithm:

1. Initialize Area into a

2. Input the value of length and width

3. Compute for the area

4. Print the area

START

A = 0

Input lw

A = l*w Print A END

Page 20: Flowcharting and Algorithm
Page 21: Flowcharting and Algorithm

• Construct flowchart that will compute & print the sum and average of a 4th gr.

periods. Write its algorithm.

• Construct a flowchart that will compute and print the sum of and average of 2 numbers. Write each

equivalent algorithm.

Page 22: Flowcharting and Algorithm

Algorithm is the sequence of steps to be performed in order to solve a problem by the computer.

Algorithms can be expressed in many different notations, including pseudocode, flowchart and programming languages.

Programming languages are primarily intended for expressing algorithms in a form that can be executed by a computer, but are often used to define or document algorithms.

A flowchart is a type of diagram (graphical or symbolic) that represents an algorithm or process. Each step in process is represented by a different symbol and contains a short description of the process step.

Flowcharts are used in analyzing, designing, documenting, or managing a process or program in various fields.

Page 23: Flowcharting and Algorithm