Professional Documents
Culture Documents
PROGRAMMING
Lecture 04
Unit 1 Problem Solving
Syllabus
Objecti
ves
2
Understand the basics symbols of
1 flowcharts
1
Step 1: [input the three integers]
read x, y, z
.
2 big = x;
If(y>big) big=y
If(z>big) big=z
parallelograms
a rectangle
Sequence
Decision
Repetition
Case
Sequence Structure
A series of actions are performed in sequence
The pay-calculating example was a sequence flowchart.
Ex.- Write an Flowchart for finding the addition of two number.
Decision Structure
One of two possible actions is taken, depending on a condition.
A new symbol, the diamond, indicates a yes/no question. If the
answer to the question is yes, the flow follows one path. If the
answer is no, the flow follows another path.
Ex-
if (x < y)
a = x * 2;
else
a = x + y;
Repetition Structure
A repetition structure represents part of the program that repeats.
This type of structure is commonly known as a loop.
A loop tests a condition, and if the condition exists, it performs an
action.
Then it tests the condition again. If the condition still exists,
the action is repeated. This continues until the condition no longer
exists.
Ex- while (x < y)
x++; YES
x < y? Add 1 to
x
Case Structure
One of several possible actions is taken, depending on the
contents of a variable.
Ex- Find maximum of 3 nos
Question Bank
1.What is algorithm?
2. Explain Steps involved in algorithm development with
suitable example.
3.What is flowchart?
4.Describe the symbol of flowcharts.
5.Draw flowchart for Fibonacci Series.