Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
75 views

IT 112 - Computer Programming 1

Uploaded by

Jerwin Taguinod
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

IT 112 - Computer Programming 1

Uploaded by

Jerwin Taguinod
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

IT 112 – COMPUTER

PROGRAMMING 1
JERWIN S. TAGUINOD, MIT
CONCEPT OF ALGORITHM

• Programming Algorithm
Is like a recipe which describe the exact steps the computer
needs to solve a problem or achieve a goal.
A recipe has a list of required ingredients and a series of
steps to make the meal defined.
Well, this is just the way an algorithm is.
In computer lingo, recipe is just like procedure, and the
ingredients are called inputs.
Your machine will look at the plan. Follow it to the letter, and
you will be able to see the results, called the outputs.
ALGORITHM

• Is a description of how a specific problem should be solved.


• It is a sequence of steps to solve a particular problem or an
ordered set of unambiguous steps that produce results and end
in a finite tine. ( Christodoulou, Szczygiet, Ktapa & Kolarz,
2018)
ALGORITHM

• In algorithm, steps are expressed in the form of a statement or


instruction. Consequently, a computer program contains a set of
statement that indicate which procedure to perform a machine,
• Algorithm must be in a ‘program’ format to be executed by
computers.
ALGORITHM

• A program is written in a software application called


programming language, and the action to express an algorithm
as a program is called programming.
THINKING BOX

• Based on our example of making a cup of coffee, what do you


think is/are the inputs? How about the output?
HOW TO WRITE AN ALGORITHM?

• STEP 1. Define your algorithm: As discussed earlier,


algorithms take in data to be processed. For instance, to
calculate the area of a rectangular, input may be the rectangle
height and a rectangle width.
HOW TO WRITE AN ALGORITHM?

• STEP 2. Define the variables: variables of the algorithm let you


use it for more than one location. We may define two variables
as HEIGHT and WIDTH ( or H & W) for the rectangular height
and rectangular width.
STEP 2:

• Note: we should use significant variable name based on its


purpose. Example, instead of using H & W use WEIGHT and
WIDTH as variable name. this is for you to easily remember the
name when used in different location of your algorithm.
HOW TO WRITE AN ALGORITHM?

• STEP 3. Outline the algorithm’s operation: use input variable


for computation purpose. For example finding area of rectangle,
multiply the HEIGHT and WIDTH variable and store the
value in new variable like AREA. An algorithm’s operations
can take the form of multiple steps and even branch, depending
on the value of the input variables.
HOW TO WRITE AN ALGORITHM?

• STEP 4. Output the results of your algorithm’s operations: In


the example area of rectangle, output will be the value stored in
variable AREA. Considering the defined algorithm’s operation,
if the input variables defined a rectangle with a HEIGHT of 2
and a WIDTH of 3, the algorithm would output the AREA with
value of 6.
TO WRITE THESE PROCESSES TO BECOME AN
ALGORITHM OF FINDING THE AREA OF A TRIANGLE:

1. Input height and weight of a triangle


2. To compute for the area of a triangle, multiply the HEIGHT
and WIDTH variables and store the value in new variable like
AREA.
3. Display the value of AREA.
TRY ME

• Write down an algorithm for cooking rice


• Write an algorithm to compute for the sum of two numbers.
ASSESSMENT TASK:
CONCEPT OF FLOWCHART AND PROGRAMMING

• Computers are dumb. They will easily be confused and make


mistakes so, one has to explain things very carefully by giving
the exact instructions. In programming, step – by – step
instructions must be followed to solve the problem known as an
algorithm.
CONCEPT OF FLOWCHART AND PROGRAMMING

• In this lesson, another powerful tool for learning programming


called flowchart will be presented. A flowchart is a method of
expressing an algorithm through the use of flowchart symbols.
Likewise, concepts of programming will also be discussed in
the latter part.
CONCEPT OF FLOWCHART AND PROGRAMMING

• At the end of the lesson, students will be given activities for


them to practice before taking the assessment task. Assessment
task will be submitted on or before the scheduled date.
LEARNING OUTCOMES:

• At the end of the lesson, the student are expected to:


define and explain the flowchart
Write and execute programming using flowchart
FLOWCHART

• Is a pictorial representation of an algorithm.


• It is also known as the flow diagram, which illustrate a process
or a detailed series of steps needed to produce a specific output.

You might also like