0% found this document useful (0 votes)
9 views

Chapter2 Algorithmdesign

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

Chapter2 Algorithmdesign

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

ALGORITHM DESIGN AND

[PROGRAMMING
LIFECYCLE]
 Programming Cycle (SDLC/PDLC)
 Developing algorithm (Flowchart; Pseudocode)
 Control Structure (Sequential; Selection; Repetition)
PROGRAMMING CYCLE
- A series of step/sequence
for developing a software
and products
Software/Program Development Life Cycle
(SDLC/PDLC)
Development of Algorithm
• Computer algorithm – an order sequence of instructions for solving
problem.
• Basic technique used to get the job done.

Example: The taxi algorithm


1. Go to the taxi stand.
2. Get in a taxi.
3. Give the driver my address.

By: Dr. NickholasAnting Anak Guntor


Types of Algorithm in Computer
Programming
Pseudocode
An artificial and informal language that help programmers develop
algorithm.

Flowchart
Diagrammatic representation of an algorithm
Pseudocode
Features Examples:
 Cannot understand by Calculate the area of rectangular.
computer. BEGIN
INPUT & DECLARE length
 Jot down ideas using human- INPUT & DECLARE width
CALCULATE area = width * length
readable language – no worry DISPLAY area
syntax error. END

 Not standardized; every


program has its own version.

 Capitalized main key-function.


Flowchart
Features

 Used standardized
symbols.

 Can draw by hand or


word processor.

 Different symbols are


used for different states
in flowchart.
Examples of Flowchart
Example 1: Add two numbers entered Example 2: Find all the roots of a
quadratic equation ax + bx + c = 0.
by user.
Control Structure
 Control Structures – Provide alternatives to sequential program execution and
are used to alter the sequential flow of execution.
 Most common control structures are:
Repetition/
Looping/
Basic Python Language with
Flowchart
Part 2

By: Dr. Nickholas Anting Anak Guntor


EXAMPLE 1
A group of programmer has been assigned to make a simple sequential
program to calculate BMI index for users.

a) List the Input, Process and Output.


b) Create flowchart & pseudocode of the above situation.
c) Write a program based on the flowchart using Python language.

BMI = weight / height2


START #This program is to calculate BMI index

print (“This is BMI Calculator”)


DECLARE float
berat,tinggi,bmi #Declaring variable & gathering input
weight = float (input(“Enter Your Weight: ”))
height = float (input(“Enter Your Height in meter: ”))
INPUT berat, tinggi

#Calculating BMI (Process)


CALCULATE bmi = weight / (height * height)
bmi=berat/(tinggi * tinggi)

#DISPLAY BMI output


DISPLAY bmi print (“Your BMI is ”, bmi)

END

By: Dr. Nickholas Anting Anak Guntor

You might also like