Unit 1
Unit 1
Symbols
Basic Example 1: Add 2 Numbers
START
Read a,b
c =/ a+b
Read a,b
STOP
Basic Example 2: Check a Number is Positive or Negative
START
Read
a
N IS Y
a>0
Print Print
“Negative” “Positive”
STOP
Algorithms ALGORITHMS AND FLOWCHARTS
A typical programming task can be divided into two phases:
Problem solving phase
produce an ordered sequence of steps that describe solution of problem
this sequence of steps is called an algorithm
Implementation phase
implement the program in some programming language
Pseudocode is an artificial and informal language that helps programmers
develop algorithms. Pseudocode is very similar to everyday English.
Basic Example 1: AddALGORITHMS
2 Numbers AND FLOWCHARTS
STEP1: Take Input of 2 Numbers a & b.
STEP2: Calculate c = a+b.
STEP3: Print c.
STEP4: STOP
Basic Example 2: Check a Number isAND
ALGORITHMS Positive or Negative
FLOWCHARTS
STEP1: Take Input of a Number a.
STEP2: Check Whether a > 0? GOTO STEP5.
STEP3: Print “Number is Negative”.
STEP4: STOP
STEP5: Print “Number is Positive”.
STEP6: STOP
Examples for Practice during Regular Theory Sessions
The Flowchart
Draw a Flowchart and Write Algorithms for the Following: