Vous êtes sur la page 1sur 10

• Term algorithm is often used to refer to logic of a

program
• Step by step description how to arrive at solution
• Written in English language

 Each instruction should be precise & unambiguous


 Each instruction should complete in finite time
 Instructions should not be repeated infinitely
 After algorithm termination, desired result must be
obtained
 How are the Algorithms developed and
represented?
 Answer: •When an algorithm is represented in
form of programming languages, it
becomes a program
 Pseudocodes •When an algorithm is represented in
 Flow chart form of graphical representation, it
becomes flow chart
 Programs
•When an algorithm is represented in
form of informal language, it becomes
pseudocode
 Psuedocode
○ Artificial, informal language.
○ Analysis tool which is used for planning program logic
○ Example: passing grade on an examination is 60.
○ Pseudocode statement :
If student’s grade is greator than or equal to 60
Print “Passed”

 Flow chart
○ Graphical Representation of an algorithm
○ Use symbols
START

Display
message “How
many hours
did you work?”

 Pictorial representation Read Hours

of an algorithm Display
message “How

 A flowchart is a much do you


get paid per
hour?”
diagram that depicts Read Pay Rate
the “flow” of a
program. Multiply
Hours by Pay
Rate. Store
result in
Gross Pay.

Display Gross
Pay

END
 Flow
 Horizontal – Left to right approach
 Vertical – Top to bottom approach
 Use of arrows
 Flow lines
 Crossing of flow lines
 Joining of flow lines
 Use of Connector
Rounded
START Rectangle

Display
message “How
many hours
did you work?”

 There are three Read Hours

types of symbols in Display

this flowchart: message “How


much do you Parallelogra
get paid per m
 rounded rectangles hour?”

 parallelograms Read Pay Rate

 a rectangle
Multiply
 Each symbol Rectangle
Hours by Pay
Rate. Store

represents a result in
Gross Pay.

different type of Display Gross


Rounded
operation.
Pay
Rectangle
END
START Terminal

Display
message “How
many hours
did you work?”

 Terminals Read Hours

 indicate a starting or Display


message “How
ending point much do you
get paid per
hour?”

Read Pay Rate

Multiply
Hours by Pay
START Rate. Store
result in
Gross Pay.

Display Gross
Pay
END Terminal
END
START

Display
message “How
many hours
did you work?”

 Input/Output Read Hours

Operations Display
message “How Input/Outp
 represented by much do you
get paid per ut
parallelograms hour?” Operation

 indicate an input or Read Pay Rate

output operation Multiply


Hours by Pay
Rate. Store
Display result in
Gross Pay.
message “How Display Gross
many hours Read Hours Pay

did you END


work?”
START

Display
message “How
many hours
did you work?”

 Processes Read Hours

 represented by Display
message “How
rectangles much do you
get paid per
 indicates a process hour?”

such as a mathematical Read Pay Rate

computation or
Multiply
variable assignment Process
Hours by Pay
Rate. Store
result in
Multiply Hours Gross Pay.

by Pay Rate. Display Gross


Pay
Store result in
Gross Pay. END

Vous aimerez peut-être aussi