Computer Programming 1
Computer Programming 1
An algorithm is “a finite set of precise instructions for performing a computation or for solving a problem”
A program is one type of algorithm
Directions to somebody’s house is an algorithm
A recipe for cooking a cake is an algorithm
The steps to compute the cosine of 90° is an algorithm
Flowchart - Graphically depicts the logical steps to carry out a task and shows how the steps relate to each
other.
Pseudo code - Uses English-like phrases with some Visual Basic terms to outline the program.
What is a flowchart?
A flowchart is a picture (graphical representation) of the problem solving process.
A flowchart gives a step-by-step procedure for solution of a problem.
Elements of a flowchart:
Various geometrical shaped boxes represent the steps of the solution.
The boxes are connected by directional arrows to show the flow of the solution.
Uses of a flowchart:
To specify the method of solving a problem.
To plan the sequence of a computer program.
Communicate ideas, solutions.
COMPUTER PROGRAMMING 1
COMPUTER PROGRAMMING 1
COMPUTER PROGRAMMING 1
Divide-and-conquer method
Used in problem solving – take a large problem and break it into smaller problems solving the small ones first
Breaks a problem down into modules
Statement structures
Sequence – follow instructions from one line to the next without skipping over any lines
Decision - if the answer to a question is “Yes” then one group of instructions is executed. If the answer is “No,”
then another is executed
Looping – a series of instructions are executed over and over
1P R C E S S Across
O
1. I am a rectangle in a flowchart. What do I
represent?
2D I A M O N D 2. When you want to show a decision making step,
3 you can use this box.
4. You can use me to communicate ideas, graphically
represent a problem solving process.
5. I connect two geometrical boxes in a flowchart.
Down
4F L O W C H A R T 1. In the flowchart, I represent data or information
that is available.
3. All flowcharts begin with me. I am elliptical in
5A R R O W shape.
II. Match the elements of a flowchart and their purpose of use in the following. Write the letter only.
Purpose Use
_____1. Calculate total of A, B, C A. Loop
_____2. Indicate that the problem has been solved. B. Start
_____3. Find if a number is greater than the other C. Process
_____4. calculate the factorial of the number. D. Input
_____5. Read three numbers E. End
_____6. Print the total F. Decision
_____7. Indicate beginning of a problem solving flow. G. Output