# Flowchart

Document Sample

```					Flowchart

1
Flowchart:
It is a diagram consists of symbolic
block that represents the
algorithm step by step
Symbols of flowchart:
1. Terminal (start, stop)
2. Input / output
3. Processing
4. Flow: concerned with direction
5. Decision: for logic comparison
6. Connector
7. Off-page connector

2
Flowchart:                         start

Ex: draw the flowchart for
1. Begin                           name,
mark
markprint name,           New_mark = mark+5

new_markNew_mark =
mark+5
3. input name, mark
print
4. new_mark = mark+5                name,
new_mar
5. print name, new_mark             k

6. End
stop

3
start

Flowchart:                            studentcount =1
Ex: draw the flowchart for
this algorithm:                                       A

1. Begin
studentcou
2. studentcount =1                      nt <= 10

3. if studentcount > 10 then   stop                          Read name,
Stop                                                        mark

else
new_mark = mark +
   read name, mark                                         5
   calculate new_mark =
mark + 5
print name,
   print name, new_mark                                  new_mark
   studentcount =
studentcount +1
   goto step 3                            studentcount = studentcount +1

A

4
Flowchart:                                  start

Ex:                                     Read x, y, L
Draw a flowchart to compute:
F=    x2 –y + x            L<0
yes
2x + y               L=0
L< 0              x2 –y + x
(x / y) + 10          L>0

1.   start                         No
yes
2.   read x, y, L
3.   if (L<0) then                         L=0                2x + y
F = x2 –y + x
No
else
if (L=0) then                     (x / y) + 10

F = 2x + y
else
Write F
F = (x / y) + 10
4.   write F
5.   stop                                  stop

5
Flowchart:
Ex:
Trace the following flowchart to find the value of max and min variable
for 4 numbers order as follows (x = 4, 2, 1, 3)?

A
start

yes
No

yes

Read x                  Max<x              Max = x
stop
No
Max=x                              yes
Min=x
Min>x              Min = x
No
I=2
I = I +1
b
A

b

6
Flowchart:
Ex:
Read name for student, when name="xxx" stop the
program, if name does not equal "xxx" then
compute the grade of every student. Every
student has five courses. The average for the
student courses has to be computed and there
by the grade is given.
Avg > = 90        ------------------------> grade = 'A'
80 < =Avg < 90 ------------------------> grade = 'B'
70 < =Avg < 80 ------------------------> grade = 'C'
60 < =Avg < 70 ------------------------> grade = 'D'
Avg < 60          ------------------------> grade = 'F'

7
Sol:
1.          Start
3.          while (name != "xxx") do
1.          begin
2.          total = 0
3.          for count = 0 to 5 do
1.        begin
3.        total = total + mark
4.        end
4.          avg = total / 5
5.          if ( avg >= 90) then
else
if ((avg >=80) and (avg < 90)) then
else
if ((avg >=70) and (avg < 80)) then
else
if ((avg >=60) and (avg < 70)) then
else
1.          Write name, grade
3.          end
4.          stop

8
A
start
C
yes
total= 0
Count= 0                                         avg > = 90           Grade='A'

B                                                 yes
yes                       No                                   and (avg <
Name =                                              90))

stop                                                        No
total= total + mark                           yes
count= count + 1               and (avg <
80)
yes
No                                     No
avg = total / 5           count < 5                  B                       yes
and (avg <
A

70))
No