0% found this document useful (0 votes)
345 views186 pages

5.3.-Prog Design Tools

The document discusses various program design tools including algorithms, pseudocode, and flowcharts. It provides examples and explanations of each tool. Algorithms are step-by-step methods for solving problems with clear inputs and outputs. Pseudocode uses plain English to describe programming logic without a specific language. Flowcharts use graphic symbols to visually represent program or system flow. The document compares the tools and provides examples of creating algorithms, pseudocode, and flowcharts for tasks like calculating averages and conversions between Celsius and Fahrenheit.

Uploaded by

G tarik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
345 views186 pages

5.3.-Prog Design Tools

The document discusses various program design tools including algorithms, pseudocode, and flowcharts. It provides examples and explanations of each tool. Algorithms are step-by-step methods for solving problems with clear inputs and outputs. Pseudocode uses plain English to describe programming logic without a specific language. Flowcharts use graphic symbols to visually represent program or system flow. The document compares the tools and provides examples of creating algorithms, pseudocode, and flowcharts for tasks like calculating averages and conversions between Celsius and Fahrenheit.

Uploaded by

G tarik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 186

Program Design tools

Algorithm
Pseudo code
Flowchart
Algorithm
 Algorithm is a method for solving a specific
problem step by step
 Conditions/feature of Algorithm:
 Must have input and output
 Must be completed within finite number of steps
 Each step should be specified and clear
 Easy to understand
 Less time complexity and memory complexity
 Can be applied to many similar problems
Write an algorithm to add two
numbers
 STEP 1: Start
 STEP 2: take A and B as input
 STEP 3: add two numbers and produce
summation
 STEP 4: show the summation as result
 STEP 5: stop
Write an algorithm to calculate
average of 3 numbers
 STEP 1: Start
 STEP 2: take three numbers as input
 i.e. Input A,B,C
 STEP 3: add three numbers and produce summation
 S=A+B+C
 STEP 4: calculate the Average by dividing
summation by 3.
 Average= S/3
 STEP 5: show the Average as result
 Print Average
 STEP 6: stop
Pseudo code
 It’s a Greek word
 Pseudo code = not true

 Its not a real/genuine program


code
 Use simple English word to solve
the problem
Pseudo code (contd.)
 Helps to develop a program smoothly
 Should be written before developing a
program
 Not depends on any specific
programming language
 Acceptable for all
Example:
Write a Pseudo code for calculating summation
of two number
 START
 INPUT A, B
 SUM=A+B
 PRINT SUM
 STOP
Write a Pseudo code for calculating
average of three numbers
 START
 INPUT A, B, C BEGIN
 S= A+B+C INPUT A, B, C
SUM = A+B+C
 Avg = S/3 AVERAGE = SUM /3
PRINT AVERAGE
 PRINT Avg END
 STOP
Flowchart
 Flowchart is a method of solving a problem by
drawing picture/symbols

 visual representation
 Graphical tool
 Pictorial method

 Use some specific symbols


 Easy to understand for all
 Communicate between user and programmer

Flowchart

Program System
flowchart flowchart
 A program flow chart is used to describe
the flow of data through a single program,
showing the exact sequence of operations
performed by that program in order to
process the data.

 A system flowchart is designed for an entire


system with each box representing a process.
Symbols that used in flowchart (program
flowchart)

Start/Stop

Input/Output

Processing
Symbols that sued in flowchart (program
flowchart)-2

Decision

Connection

Flow
Rules of drawing flowchart

 Name and date of the flowchart should be


mentioned at the beginning
 Size of the symbols can be changed but not
the shapes
 Top to Bottom and Left to Right direction
will be followed
 Writing inside the symbols will be shorter
and easy to understand
 Flow lines should not intersect each other.
 Even if intersection occurs there is no
relation between them

Remarks/comment should be given if necessary


Flowchart for adding two numbers

Start

Input
A,B

Sum:=A+B

Print
Sum

Stop
Write an algorithm to add two
numbers
STEP 1: Start
STEP 2: Input A and B
STEP 3: Sum= A+B
STEP 4: Print Sum
STEP 5: stop
Write an algorithm to add two
numbers
STEP 1: Start the program
STEP 2: take 2 numbers as Input
STEP 3: calculate Sum by adding
2 numbers
STEP 4: Print the sum as result
STEP 5: stop
Stem:Describe each step of the flowchart
Start

N1, N2

S=N1+N2

Stop
Stem:
 Step 1: Read two Numbers
 Step 2: Add the Two numbers and multiply
by first number
 Step 3: Print the Result

 C) Draw the Flowchart


 D) how the steps are related with steps
of a program development?
Algorithm Vs Flowchart
Algorithm Flowchart

Algorithm is a method for Flowchart is a Visual


solving a specific problem representation of solving a
step by step specific problem.
Algorithm Vs Flowchart
Algorithm Flowchart

Algorithm is a method for Flowchart is a Visual


solving a specific problem representation of solving a
step by step specific problem.

It’s a descriptive procedure It’s a visual tool


Algorithm Vs Flowchart
Algorithm Flowchart

Algorithm is a method for Flowchart is a Visual


solving a specific problem representation of solving a
step by step specific problem.

It’s a descriptive procedure It’s a visual tool

Hard to understand easy to understand


Algorithm Vs Flowchart
Algorithm Flowchart

Algorithm is a method for Flowchart is a Visual


solving a specific problem representation of solving a
step by step specific problem.

It’s a descriptive procedure It’s a visual tool

Hard to understand easy to understand

Direction of program flow can’t Direction of program flow can


be understood be understood
Algorithm Vs Flowchart
Algorithm Flowchart

Algorithm is a method for Flowchart is a Visual


solving a specific problem representation of solving a
step by step specific problem.

It’s a descriptive procedure It’s a visual tool

Hard to understand easy to understand

Direction of program flow can’t Direction of program flow can


be understood be understood

Debugging is hard Debugging is easy


Algorithm for adding two Flowchart for adding two
numbers numbers

STEP 1: Start
Start

STEP 2: take two numbers


as input Input A,B

STEP 3: add two numbers S=A+B


and produce summation

Print S
STEP 4: show the
summation as result
Start
STEP 5: stop
Flowchart for calculating average of
three numbers (what if also need sum)
Start

INPUT
A,B,C

S=A+B+C

Avg=S/3

PRINT
Avg

Stop
Flowchart for calculating average of
three numbers (what if also need sum)
Start

INPUT
A,B,C

Avg=(A+B+C)/3

PRINT
Avg

Stop
 Step1: Start
 Step2: Input A,B,C
 Step3: S=A+B+C
 Step4:Avg= S/3
 Stro5: print Avg
 Step6:stop
Step1: Strat
Step2: Input A,B,C
Step3: Avg=(A+B+C)/3
step4: Print Avg
Step5: stop
 Bangladesh Cricket Team won the toss and
choose to bat first against NZ. After
completing batting the score board showed
Tamim Scored a runs, Sakib scored b runs
and Riyadh scored c runs. All expecting that
Bangladesh will win the match.
 C) Draw a Flowchart to calculate average run
of Tamim, Sakib and Riyadh.
 there are 20 apples In a Basket. By
measuring I got weight of 3 apples
respectively 150g, 175g and 210g.

 C) Draw a Flowchart to calculate average of 3


apples
Stem
 In Annual examination, Sabbir got 67 in
Bangla, 84 in English , 55 in Chemistry and
90 in ICT. Draw a flowchart to find the
average of his marks.
Start

B= 67, E=84, C=55 ICT=90

B+E+C+ICT
Avg =
4

Print Avg(74)

Stop
c) Describe each step
d) How can you add a new number and make change
of the flowchart for calculating average of them.
Start

Read N1,N2,N3

Total=N1+N2+ N3

Print Total

Stop
Area of a rectangle

Width

Height

Area= Width * Height


Area of a Rectangle

Start

READ W,H

Area=W*H

PRINT Area

Stop
Perimeter=2(a+b)
Stem: volume of the fig?

V= w*h*d
Area of a Square

Area=a2
Area = a * a
Area=a^2
Start

READ A

Area=A*A

PRINT Area

Stop
Area of a triangle

Height

Base
Start

Read B,H

print Area

Stop
A B

If A≠B≠C then ...........


Area of a triangle (depends on the 3 sides of traingle)

C
A

A+B+C
S= 2
Area = S(S-A)(S-B)(S-C)
Start

INPUT A,B,C

S=(A+B+C)/2

Area = S(S-A)(S-B)(S-C)

PRINT Area

Stop
Area of a Circle

Area= π x r2

π= 3.1416
Area= 3.1416 x r2
Start

READ R

Area=3.1416*R*R

PRINT Area

Stop
From F to C
C=(F-32)*5/9
Start

INPUT
F

C=(F-32)*5/9

PRINT
C

Stop
 Brother of Arif is suffering from fever. So Arif
took a clinical thermometer and checked the
temperature. The thermometer had the facility
to measure both Fahrenheit and Celsius.
 In Fahrenheit the temperature shows 1000F
 Write a FC to convert his temperature in
Celsius.
Start

F=100

C=(100-32)*5/9

PRINT
C(37.77)

Stop
C = (F-32) 5/9
(9/5)*C= F-32
(9/5)*C+32=F
F=(9/5)*C+32
From C to F
F=C*9/5+32
Start

INPUT
C

F=C*9/5+32

PRINT
F

Stop
Stem:
 Mother's age is 3 times higher than
son. Father's age is more than 5
years of Mother’s age. Age of the
son is X
 C) Write an algorithm for determine
age of mother and father .
 Input X
 M= X*3
 F= X*3+5
 Print M,F
Start

INPUT
x

m=3 * X
f=3*X+5

PRINT
m,f

Stop
Sequence structure 

Entry

Action 1

Action 2

Action 3
Condition
Entry

True
False
Condition?

Action2 Action1
Flowchart for determining bigger
between two numbers
Start

INPUT
A,B

No Yes
Is A>B?

Print B Print A

Stop
Write Algorartithm for the above Flow chart

Step1 :START
Step2:INPUT A, B
Step3: IF A>B then PRINT A
 ELSE PRINT B
Step4:STOP
Write Algorartithm for the above Flow chart

Step1 :START
Step2:INPUT A, B
Step3: IF A>B then goto step4
ELSE go to step5
 Step4: print A
Step5: print B
Step6:STOP
Write Algorartithm for the above Flow chart

Step1 :START
Step2:INPUT A, B
Step3: is A>B ?
 Yes: Print A
 No: print B
Step4:STOP
Flowchart for determine bigger between
two numbers (alternate solution)
Start

INPUT
A,B

Yes No
A>B?

Print A Print B

Stop
Flowchart for determine the smaller
between two numbers
Start

INPUT
A,B

No Yes
A<B?

Print B Print A

Stop
Flowchart for determine the smaller
between two numbers (alternate)
Start

INPUT
A,B

Yes No
A<B?

Print A Print B

Stop
Draw a flowchart to find the bigger between 2 numbers.
Also consider whether both numbers are equal.

Start

INPUT A,B

No Yes
A=B?

No Yes
A>B?

Print
Print B Print A A and B are Equal

Stop
 Step1: Start
 Step2: INPUT A,B
 Step3: If A=B then print A & B are equal
 Step4: Else if A>B then Print A
 Step5: Else Print B
 Step6: Stop
 Step1: Start
 Step2: INPUT A,B
 Step3: If A=B then print A & B are equal
 Step4: if A>B then Print A
 Step5: if B>A Print B
 Step6: Stop
stem
Step1: Start
Step2: input F
Step3: if F=0 then goto step2
Step4:calculate C= 5/F+F2/2
Step5: show value of F and C
Step6: stop
Stem: describe steps if A=10 and B=11.

Begin

A=? , B=?

Is A<B?

Y=A X=B

Print X or Y

End
Stem: describe steps.
1.Start

2.Read
A,B

3.A<B

5.A

4.B

6.End
Stem Start A=10
B=17
C=13
Read A,B,C

N Y
B>A

X=? X=?

N Y
X<C

PRINT PRINT
? ?

Stop
Draw a flowchart to determine a student is pass or
fail in ICT; Consider the pass marks is 33(out of
100).

1. Start
2. Input M
3. If M ≥33 then print Pass
4. Else Print Fail
5. Stop
Draw a flowchart to determine a student is pass or
fail in ICT; Consider the pass marks is 33(out of
100).

Start

Input M

No M≥33? Yes

Print Fail Print Pass

Stop
 A super shop offers a special package
before new year. If any customer
purchase goods of tk 5000 or less, he
will get 20% discount. But if he buys
products of more than tk 5000, he will
get 25% discount . Draw a flowchart for
determining discount.
Purchaged Discount
Amount
5000 or less 20%

More than 5000 25%


 Start
 Input M

 If M ≤ 5000 then
 D=M*20/100
 Else
 D=M* 25/100

 print D
 Stop
Algo : Next Page

Start

Input M

N Y
M ≤ 5000

D=M*0.25 D=M*0.20

Print D

STop
Stem: sales man got
 Tk 01 to 1000 then comm =10%
 Tk 1001 to 2000 then comm=15%
 Tk 2001 or more then comm=20%
Read M

Y
N
M<=1000

N Y
M<=2000

C=m*20/100 C=m*15/100 C=m*10/100


Age Status
More than 16 Senior
13-16 Intermediate
Below 13 Junior
Start

INPUT A

No Yes
A>16?

No Yes
A<13?

Print
Intermediate Print Junior Senior

Stop
Start

INPUT A

No Yes
A<13?

No Yes
A>16?

Print
Intermediate Print Senior Junior

Stop
Start

INPUT A

A≥13 Yes
No
&
A≤16

No Yes
A<13?

Print
Senior Print Junior Intermediate

Stop
Selling Status
amount(Tk)
More than 10000 Skilled

10000 or less Good


Start

Input M

No M>10000? Yes

Print Good Print Skilled

Stop
Selling Status
amount(Tk)
More than 10000 Skilled

10000 or less Good

Below 5000 Average


Start

Input
A

NO Is Yes
A>10000?

NO Is Yes
A≤10000
And A≥5000? Print
Skilled
Print Average Print Good
HSC 18
 In annual sports students of eleven
class are divided in three groups A, B
and C. Students having roll no 1 to 30
will be in group "A", 31 to 60 will be in
group "B" and 61 to 100 will be in group
"C“
 Write down the FC to make the group
as mentioned in stem.
 Input R
 If R>=1 and R<=30
 Print Group A
 Else If R>=31 and R<=60
 Print Group B
 Else
 Group C
 Input R
 If R<=30
 Print Group A
 Else If R<=60
 Print Group B
 Else
 Group C
Start

Input
R

NO Is Yes
R>=1 and
R<=30?

NO Is Yes
R>30
And R<=60? Print
Group A
Print Group C Print Group B
-3 -2 -1 0 +1 +2 +3
Draw a flowchart to find a number is positive,
negative
Start
INPUT
X

No Yes
X≥0?

Print Print
X is Negative X is Positive

Stop
Draw a Algorithm to find a number is positive,
negative

 Step1: Start
 Stept2: Input X
 Stept3: if X≥0 then
 Print X is Positive

 Stept4: else
 Print X is Negative
 Step5: Stop
Draw a flowchart to find a number is positive,
negative or Zero.(Alternate)
Start
INPUT
X

No Yes
X>0?

No Yes
X<0?

Print Print Print


Its Zero Its Negative X Positive

Stop
Begin

Read Num

Is Num>0 Yes Num is Positive

No

Is Num<0 Yes
Num is Negative

No
Zero

End
 Step1: Start
 Stept2: Input Num
 Stept3: if Num>0 then
 Print Positive

 Stept4: else if Num<0


 Print Negative
 Step5: else
 Print Zero
 Step: Stop

Write an algorithm to deternime
odd/even
 Step1: Begin
 Step2: Read X
 Step3: R= X MOD 2
 Step4: if R=0 then X is Even
 Step5: else X is Odd
 Step6: End
Draw a flowchart to determine a number is odd
or Even

Start

INPUT X

R = X MOD 2

No Yes
R=0?

Print Odd Print Even

Stop
Stem

Start

INPUT X

R=X%2

No Yes
R=1?

Stop
Stem: Write Algo if x=15

Start

INPUT X

X%2
>0?

Print Even Print Odd

Stop
Leap Year or Not
 Y MOD 400=0
 OR
 (Y MOD 4=0) AND (Y MOD 100≠0)
Determine a Leap year or Not
Start

Read Y

No Y% 400=0 Yes
or
(Y %4=0) AND (Y%100≠0)

Print Print
Not Leap Year Leap Year

Stop
Start

INPUT
Y

N Y
Y%400=0

Y%4=0
N Y
&
Y%100≠0
Print Print
Not Leap Year Leap Year

Stop
Input Y
 If Y%400=0 then
 print Leap year

 Else if Y%4=0 & Y%100≠0


 print Leap year
 Else
 Print NOT leap year
 Stop
 Sushmita’s teacher asked her about her date
of birth so she replayed 29/02/2000. the
teacher told her that she will not able to
celebrate her birthday in every year and also
make her understand by using formula which
years she can celebrate her birthday.

 Write and FC and algorithm program


Start

INPUT
Y

N Y
Y%400=0

N
Y
Y%4=0

` Y
Y%100≠0
N
Print Print
Not Leap Year Leap Year
Flowchart to determine the largest
among three numbers
Start

INPUT
A,B,C

No Yes
A>B?

Yes No No Yes
B>C? A>C?

Print B Print C Print A

Stop
IF A= 10, B =7, C =15 , REDRAW
THE FC
Flowchart to determine the largest among
three numbers
Start

A=10
B=7, C=15

Yes
A>B?

No
A>C?

Print C(15)

Stop
Find the largest side from the
following triangle

a C

b
Stem:
 Bangladesh Cricket Team won the toss and
choose to bat first against NZ. After
completing batting the score board showed
Tamim Scored a runs, Sakib scored b runs
and Riyadh scored c runs. All expecting that
Bangladesh will win the match.
 D) Draw a Flowchart to determine who scored
highest runs in the stem
Write an algorithm to find the biggest
of 3 numbers
 Step1: Start
 Step2: Input A,B,C
 Step3: if A>B and A>C then Print A
 Step4: Else if B>A and B>C then Print B
 Step5: Else Print C
 Step6: Stop
Write an algorithm to find the biggest
of 3 numbers(Another Solution)
 Step1: Start
 Step2: Input A,B,C
 Step3: if A>B and A>C then Print A
 Step4: if B>A and B>C then Print B
 Step5: if C>A and C>B then print C
 Step6: stop
Stem: Draw Flowchart,
what change do u need to determine average of 3 number

 1) Start , 2) Input a,b,c


 3) Is a bigger than b and c?
 A) yes

Print Result : a is largest
 And goto step 6

 b) No
 4) is b bigger than c
 A) Yes
 Print result : b is largest
 And goto step 6
 b) No
 5) Print result: c is largest
 6) Stop
Stem: write Algorithm for the
flowchart
Start

INPUT
A,B,C

Yes No
A>B?

Yes No No Yes
A>C? B>C?

X=A X=C X=B

Print X

Stop
Write an algorithm for the stem

 Step1: Start
 Step2: Input A,B,C
 Step3: if A>B and A>C then X=A
 Step4: Else if B>A and B>C then X=B
 Step5: Else X=C
 Step6: Print X
 Step7: Stop
Stem: Replace 2nd Box by Read x,y,z

Begin

Read x,y

Print x x<y? Print y

End
Flowchart for determine the
smallest among three numbers
Start

INPUT
x,y,z

No Yes
x<y?

Yes No No Yes
y<z? x<z

Print y Print z Print x

Stop
Stem: what will happen if another
input C is added ?
1.Start

2.Read
A,B

3.A<B

5.A

4.B

6.End
Stem: describe the procedure to show the
result step by step
Start

A=10, B=9,
C=16

No Yes
A<B?

Yes No No Yes
B>C? A>C?

Print B Print C Print A

Stop
Draw a Flowchart to display the word
“Dhaka” For 1 times
Start
Start

PRINT
PRINT Dhaka
Dhaka
PRINT
Dhaka
End

End
Loop
Entry

Condition

Yes

Action
Loop Entry

No
Condition

Yes
Exit

Action
What about of this
 Dhaka
 Dhaka
 Dhaka
 Dhaka
 Dhaka
 Dhaka
 Dhaka
 Dhaka
 Dhaka
 Dhaka
Draw a Flowchart to display the word
“Dhaka” For 10 times
1

i=1
2

4 6

5
Output=?
Ans:
Start
2
c=2 5

No
8
c<23? 11
Yes 14
Print
c 17
Stop
c=c+3 20
Draw a Flowchart to display Odd digit
from 5 to 99 i.e 5,7,9,……97,99
Start

i=5

No
i≤99?

Yes
Print
i
Stop
i=i+2
Stem: RB 2017
 See the series given below and answer the
question:

 10, 20, 30, …………………, 100

 Draw a Flowchart shown the stem and


describe
Start

c=10

No
c<=100

Yes
Print
c
Stop
c=c+10
 Mr. X joined in a company in contractual basis
on 1/1/2018. His company produce some kind
of communication medium which can carry
signal in the speed of light. Since his job was
contractual, he need to attend office only 1 day
in every four day.

 Draw a flowchart that will show the dates when


Mr. X will attend the office for 1st month.
Start

i=1

No
i<=31

Yes
Print
i
Stop
i=i+4
Stem
 3. Uttara
 5. Uttara
 7. Uttara
 9. Uttara
 …………..
 …………..
 101. Uttara
Start

i=3

i≤101?
No

Yes
Print
i. uttara
Stop
i=i+2
Draw a Flowchart to calculate the Summation of the
following series:
2+3+4+5=?
S=0
i=2

Start S=2
i=3

S=0 S=5
i=2 i=4
S=9
No i=5
i≤5?
S=14
Yes i=6
S=S + i
PRINT S
i= i+1
Stop
Draw a Flowchart to calculate the summation of the
following series: 3+5+7+. . .. . . . . .. . . . .. .+99
1
Start

2
S=0
i=3

No
3 i≤99?

Yes
S=S + i
4
5 PRINT S
i= i+2
6 Stop
Draw a Flowchart to calculate the summation of the following
series: 3+5+7+. . .. . . . . .. . . . .. .+99(another solution)

1 Start

S=0
2 Now, Step3=?
i=3

i>99? Yes
3

No
S=S + i
4 5 PRINT S
i= i+2
6 Stop
Draw a Flowchart to calculate the summation of the following
series: 3+5+7+. . .. . . . . .. . . . .. .+99(another solution)

Start

S=0
i=3

S=S + i

i= i+2

No
i≤99?

yes
PRINT S

Stop
Draw a Flowchart to calculate the summation of the following
series: 3+5+7+. . .. . . . . .. . . . .. .+99(another solution)

2 S=0
i=3

4
No 5

6
Draw a Flowchart to calculate the summation of the
following series:
4+7+10+. . . . . . . .. . .+N
1 Start

2 INPUT N

S=0
3
i=4

4 No
i≤N?

Yes
S=S + i
5 6
PRINT S
i= i+3
7 Stop
Stem
consider input N=7
1 Start

2 INPUT N

S=0
3 i=2

4 False
i≤N?

True
S=S + i
PRINT S
i= i+2

Stop
 Step1: Start
 Step2: N=7
 Step3: S=0, i=2
 Step4: Since , i≤N True
 Step5: S=S+i,
S=0+2= 2
i=i+2, 2+2=4
Step6:since i<=N True
S=S+i, S=2+4= 6
i=i+2, 4+2=6

Step7: since i<=N True


S=S+i, S=6+6= 12
i=i+2,i=6+2 =8
Step8: since i<=N False

Step9: Print S(12)


Stem: Draw Flow Chart for the algorithm
given below
 Step1: INPUT N
 Step2: S=0, i=1
 Step3: S=S+i, i=i+1
 Step4: while i≤N repeat Step 3
 Step5: PRINT S
c)Draw a flowchart for the above stem.
D)How many iteration will be there for N=10? Show the
values of Sum and C in different iterations for N=10.

 START
 Step-1: Input
1.1 Read, N
 Step-2: Process
 2.1 Sum=0, C=2
 2.2 Sum=Sum + C
 2.3 C= C+2

 2.4 if C>N then goto step-3.1 otherwise goto Step-2.2


 Step-3 : Output
 3.1 Print Sum

 STOP
Show all numbers from 1 to N
those can be divided by 2
Start

Input N

i=1

NO
i<=N?
i=i+1
Yes
Stop
N i%2=0?

Y
Print i
Scenario-1 Scenario-2
Start Start

S=0 S=0
i=2 i=2

S=S+i Yes
i>6

Print S No Print
Good Luck
S=S+i
i=i+1 Stop
Print S
No Yes
i>6
i=i+1
Print
Good Luck

Stop
Scenario-1 Scenario-2
Start Start

S=0 S=0
i=7 i=7

S=S+i Yes
i>6

Print S No
S=S+i
i=i+1
Print S
No Yes
i>6
i=i+1
Draw a Flowchart to calculate the summation of the
following series:
22 +32 +42 +…………….+ 202
1
S=S+i^2
2 S=0 or
i=2 S=S+i*i

4
5

6
14 +34 +54 +- - -- -- ---- --- -- ---+N4

1 +33 +55 +- - -- -- ---- --- -- ---+9999


Draw a Flowchart to calculate the summation of the
following series:
50+49+48+……….+5

S=0
i=50
i≥5?
S=S+i
i=i-1
Draw a Flowchart to calculate the multiplication of the
following series:
1*2*3* . . .. . .*5=?

M=1
i=1
c)Draw a flowchart for the above stem.
D)How many iteration will be there for N=10? Show the
values of P and C in different iterations for N=10.

 START
 Step-1: Input
1.1 Read, N
 Step-2: Process
 2.1 P=1, C=2
 2.2 P=P x C
 2.3 C= C+2
 2.4 if C>N then goto step-3.1 otherwise goto Step-2.2
 Step-3 : Output
 3.1 Print P
 STOP
Draw a Flowchart to calculate the multiplication of the
following series:
20*19*18*. . . . . . . . . . . . *1

M=1
i=20
Factorial
 Factorial of 5 is 5*4*3*2*1
Or 1*2*3*4*5

 Factorial of 6 is 6*5*4*3*2*1
Or 1*2*3*4*5*6
 Factorial of N is N*(N-1)(N-2)(N-3)*…..*1

 Or 1*2*3*. . . . . . .*N
Draw a Flowchart to calculate the factorial value of any
positive integer ( Logic = 1*2*3*. . . . . . .*N)

F=1
i=1

No

Yes
Draw a Flowchart to calculate the factorial value of any
positive integer Logic = N*(N-1)*(N-2)*(N-3)*…….*1

F=1
i=N

No

Yes
Draw a Flowchart to calculate the factorial value of any
positive integer
Logic = N*(N-1)*(N-2)*(N-3)*…….*1(best solution)

F=1

No

Yes
Stem: consider N=4,
how many iteration? What is the result?
Step2: F=1, N=4
Start Step3: F=F*N
F=1*4= 4
F=1 N=N-1=3
Step4: N>=1 True
INPUT N Step5: F=F*N, 4*3=12
N=N-1, 3-1=2
F=F*N Step6: N>=1 True
N=N-1 Step7: F=F*N, 12*2=24
N=2-1=1

Step8: F=24*1, =24


Y N N=1-1=0
N>=1
OUTPUT F

Stop
Stem: c) Draw flowchart and
d) what will occur if Step 6 is written inthe new following way
if C>N GOTO step 7 else goto 3

 Step1: Start
 Step2: Input N
 Step3: F=1, C=1
 Step4: F=F*C
 Step5: C=C+1
 Step6: if C>N then GOTO Step 7 otherwise
GOTO step4
 Step7: Print F
 Step8: Stop
1
Start

2 INPUT N

3 F=1, C=1

4 F=F*C

5 C=C+1

N Y
C>N
6 OUTPUT F 7

Stop 8
Draw a Flowchart to calculate the GCD (Greatest
common divisor) value of 2 integer number

1 Start

INPUT L,S
2 (L>S)

R=L MOD S
3

L=S No
5 R=0?
S=R
4
Yes

6 PRINT S

7 Stop
stem
Begin

L=30
S=15

R= L % S

L=S Yes
R=0
S=R No

Print S

End
1) Start
2) L=18, S=12
stem 3) R=L%S
Begin R=18%12=6
4) Since R>0, true
L=18 5)L=S, L=12
S=12
S=R, S=6
6) R=L%S, 12%6=0
R= L % S
7)Since R>0 False
8) Print S(6)
No 9) stop
L=S R>0
S=R Yes

Print S

End
Stem:
 After discussing details about Flowchart ICT
teacher ask the student to calculate the GCD
of 6 and 12.
 C) Draw a FC for the stem mention above
Start

L=12,S=6

R=L(12) MOD S(6)

R=0?

Yes
PRINT S(6)

Stop
Stem: if L=18 and S=30, is it possible to get any result
from this FC? Explain with logic !

Start

INPUT L,S
(L>S)

R=L MOD S

L=S No
R==0?
S=R

Yes
PRINT S

Stop
IS IT POSSIBLE TO WRITE AN ALGORITHM FOR THE
FLOWCHART IN THE STEM BY COMPARING VALUE OF R
WITH 1 INSTEAD OF 0. ANALYZE YOUR ANSWER
Start
LCM
2 Input A,B

No 3 Yes
A>B
4
5 X=B X=A

6
X%A=0 Yes
& 8
X%B=0?
Print LCM=X
No
7 X=X+1
Stop
 2: Input A,B
 3: if A>B then goto step 4 else goto step5
 4: X=A
 5: X=b
 6: if X%A=0 and X%B =0 then goto 8 else got
7.
 7: X=X+1 goto 6
 8: print LCM=X
 9: stop
Try your self
1) Draw a Flowchart to calculate the sum of the all even numbers
from 1 to 100
2) Draw a Flowchart to calculate the sum of the all Odd numbers
from 1 to N
3) Draw a Flowchart to calculate the value of the following series
i)13+23+33 . ………....………….+1333
ii) 33+44+55+. . ………....…..….+103103
iii) 23+45+67+ ………..………….+100101
iv) 1+3+9+27+81+………………+N
v) 20+21+22+23+24+……………………+28
vi) 100+98+96+…………………..+N

vii)
1 1 1 1
1 
viii) 2*3+ 4*5+    .......... ... 
26*7+……………………….+500*501
3 4 N
 510+1020+1530+…………………….+N2N

S=S+i^(i*2)
 (952+90)*(852+80)*(752+70)*………(252+20)
 S=1, i=95
 i>=25
 S=S*((i^2)+(i-5))
 i=i-10
(72 +10)*(102 +13)*(132 +16)*………*(392 +42)
S=1, i=7
i<=39
S=S*((i^2)+(i+3))
i=i+3
STEM: OUTPUT ?
Start

i=1

i<=5 N

y
j=1

N
j<=3

y Stop
Print j

j=j+1
Fibonacci
Prime number

You might also like