Introduction to computer Programming
Introduction to computer Programming
Programming
Problem Solving and Implementation
A programming task can be divided into two
phases:
1. Problem solving
Define : Clearly describe a problem
Design its solution: Produce an ordered sequence of
steps that describe solution to the problem;
2. Implementation phase
Implement the program in some programming
language
write code, compile, link, Test & Debug
Developing a program
Problem solving
Phase
Implementation phase
Defining a Problem:
Break the definition of the problem down into manageable
steps. Example; input, Processing; Output
• Pseudo Code
• Flowchart
Preferably using control Structures.
Algorithm
Pseudo code
• Pseudo code is a method of designing a program
using English like statement to describe the logic and
processing flow.
Example -1:
Read in the temperature. If the temperature is less than
32 indicate below freezing on the screen. Else if the
temperature is above freezing then indicate the same on
the monitor screen.
• Example -1:
Read the Temperature
if (Temperature < 32) then
Display on screen “BELOW FREEZING”
else
Display on screen “ABOVE FREEZING”
End
Algorithm contd
Pseudo code
Example 2
Write a pseudo code to calculate the weekly
wages of an employee. The pay depends upon
wages per hour and the number of hours
worked.
– Processing Steps
– Input/Output
– Decision
Example -1:
Read in the temperature. If the temperature is less than
32 indicate below freezing on the screen. Else if the
temperature is above freezing then indicate the same on
the monitor screen.
Read a, b
and c Print b
Yes
Is No Is No
Print c
a>b b>c
Yes
Is No
Print c
a>c
Yes
Print a
End
CSC 141 Introduction to computer
programming