Introduction to
Computer
Programming
Process
Procedure
Algorithm
A series of actions or steps taken to achieve an end.
A series of actions conducted in a certain order.
An ordered set of steps to solve a problem.
Flowcharts in
Programming
Examples
Print value of x
Class activity
Write a very detailed
and step-by-step
procedure on how to
prepare a homemade
lemonade using
flowcharts.
Class activity
Quality Control Process Flow Chart
Class activity
Design an algorithm to solve
the following maze using
flowcharts.
Pseudocode
Written language that is part-code English and helps a programmer to plan the layout
of his program.
Example:
Define N
N  15
Multiply N by 100
Print N to Main Label
How to write pseudocode
A computer can:
1. Receive information (Read, Obtain, Get)
2. Put out information (Print, Display, Show)
3. Perform arithmetic (Compute, Calculate, Determine, Increment, Decrement,
Compare)
4. Assign a value to a variable or memory location (Define, Set, Init)
5. Compare two variables and select one of two alternate actions (IF, THEN, ELSE,
ELSE-IF, ENDIF)
6. Repeat a group of actions (FOR, NEXT, WHILE, ENDWHILE, REPEAT, UNTIL)
Example
Conditional Loops
FOR
for counter from 1 to N do
conditional code
end for
repeat N times
conditional code
end repeat
Class Activity
Conditional Loops
WHILE while condition do
conditional code
end while
Conditional Loops
DO- WHILE
do
conditional code
while condition
end while
Flowchart vs Pseudocode
Class activity
Smoke detection code:
If smoke sensor detect
upnormal amount of smoke,
then alarm system activate
(sound alarm, light change,
send sms, autocall), then
smoke controller runs, open
sprinklers, open ventilation
system.
Homework (Solar Tracker)
Azimuth – This is the compass angle of the sun as it moves
through the sky from East to West over the course of the day.
Zenith – This is the angle of the sun looking up from ground
level or the horizon.
Design an algorithm by using pseudocode for a
solar tracker. This solar tracker must follow the
sun in order to get the most efficient output.
Please specify how both azimuth and zenith
can be used for this purpose.
Class activity
Write a very detailed and
step-by-step paragraph on
how to find the shortest
path.
Start: A
End: C

2 introduction to computer programming