Programming Fundamentals: 4.00 Credit Hours, Fall 2014, Undergraduate Program
Programming Fundamentals: 4.00 Credit Hours, Fall 2014, Undergraduate Program
Programming Fundamentals
4.00 Credit Hours, Fall 2014,
Undergraduate Program
Instructor: Maryam Ehsan
SESSION 1, 2
© www.uogsialkot.edu.pk
Developing a program
Problem solving
Phase
Implementation phase
Input ; Read the temperature from keyboard
Processing; Test the Temperature below or above
freezing
Output; Display the result on Screen
Algorithm
A sequence of language independent steps which may be
followed to solve a problem. An Algorithm can be
developed with a:
• Pseudo Code
• Flowchart
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 the Temp
if (Temp < 32) then
Print “BELOW FREEZING”
else
Print “ABOVE FREEZING”
endif
Flowchart
• Diagrammatic or Graphical representations of steps
for solving the given problem.
• Use standard symbols developed by ANSI (American
National Standard Institute)
Building Blocks of Flowchart
Start and End Symbols
Connector
Arrows (indicate flow of control)
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.
1. Set N=1
Set Sum = 0
2. Repeat step 3 & 4 while N <= 5
3. Sum = Sum + N
4. N=N+1
5. Print Sum
6. end
Design the Solution
Example-2; Determine the sum of first 50 natural
numbers.
Algorithm; Flow Chart
Start
Sum=0
N=1
N≤5 Y Sum=Sum+N
N=N+1
N
Print
Sum
End
Developing a program
Problem solving
Phase
Implementation phase
Implementation Phase
Write a program (source code)
Compile a program (source code to Object code)
Link a Program ( Object code to Executable code)
Test and Debug the Program (rectify the errors in the
program)
Write a code