Programming Fundamentals 1
Programming Fundamentals 1
Fundamentals
Course Code: CS-312
Instructor: Muhammad Bilal
Introduction to Problem Solving
Problem Solving means to solve problems
Computers are used to solve various problems
Thereare specific steps to be carried out to
solve problems in computer programming
There are some steps to be followed to find the
solution:
Analysing the problem
Developing the algorithm
Coding
Testing and debugging
Flowchart
Flowchart is a diagrammatic representation of an
algorithm
A flowchart can be helpful for both writing programs and
explaining the program to others.
Oval Symbol
The oval symbol represents the start and end
Rectangle Symbol
The rectangle symbol shows the processing step
Diamond Symbol
A diamond represents a decision or branching point. Lines coming out from
the diamond indicates different possible situations, leading to different sub-
processes
Parallelogram Symbol
It represents information entering or leaving the system (input/output)
Flow Lines
Flowchart Examples
Flowchart for input two numbers, adding the two
numbers and print the result
Flowchart Examples
Flowchart for checking the number, whether the
number is positive or negative
Algorithm
Analgorithm is a procedure used for solving a
problem
Algorithm acts as list of instructions for solving
a problem
An algorithm is a well-defined sequential
computational technique that accepts a value
as input and produces the output(s) needed to
solve a problem.
Algorithmsare set of instructions or rules that
guide the computer in performing a particular
task.
Algorithm
Algorithmis language-independent, we write the
steps to demonstrate the logic used for solving a
problem.
Example 1: algorithm to multiply 2 numbers and
print the result:
Step 1: Start
Step 3: Declare a, b, c variables.
Step 4: Take input for a from the user
Step 4: Take input for b from the user
Step 5: We need to multiply a and b variables so, c = a *
b
Step 6: Here we need to print the output. So write print c
Step 7: End
Algorithm
Example 2: Write an algorithm to find the
average of 3 subjects:
Interpreters
Assemblers
Introduction to Programming
Compiler