Sie sind auf Seite 1von 12

FLOW CHARTS

It is a chart showing flow of logic involved in solving


the problem.
It is defined for an algorithm.
It can also be defined as the diagrammatic
representation of an algorithm.
It is also defined as a visual or graphical representation
of an algorithm.
It is easy to understand and analyze the problem.
It is an useful aid for programmers and system analysts.
It is machine independent. They can be used for any
type of logic

Symbols used in Flowcharts

Name Symbol Function
Terminal
To indicate begin and end in a flowchart
Input/output
Input or output data or information
Processing
Calculations, data manipulation or
information processing
Looping
Processes a group of instructions
repeatedly
Decision
A comparison or decision which leads the
flow of control to take alternate paths
Predefined
process
Group of operations not listed in the
particular flowchart
Connector
An entry from or an exit to another part in
a flowchart
Flow Direction
Represents the direction of flow of control
Start
Read A, B, C
A>B
A>C B>C
Print A Print C
Print B Print C
Stop
Flowchart to find the largest of 3 numbers
Q Show using flowchart how to find the average height of boys and average height
of girls in the class.

Ans:
t_b_h total boys height
t_g_h total girls height
t_b total no of boys
t_g total no of girls
a_v_b average height of boys
a_v_g average height of girls
n total no of students
n1 no of boys and girls after each iteration
code=0 (for girl)
code=1 (for boy)
start
read roll no , code , height
t_b_h 0
t_b 0
t_g_h 0
t_g 0
n 10
a_v_g 0
a_v_b 0
n1 0
code =1
t_b_h t_b_h + height
t_b t_b + 1
n1 n1 + 1
t_g_h t_g_h + height
t_g t_g +1
n1 n1+1
A
B
Y N
A
n1=n B
a_v_b t_b_h / t_b

a_v_g t_g_h / t_g
Print a_v_b , a_v_g
Stop
To find largest
of n numbers
using 2 memory
locations num1
and num2
Read n , num1
Start
repeat till 4 ,
till n = 1
read num2
num1 num2
num2>num1
n n-1
Print num1
stop
4
Q) Draw a flowchart to count the number of non-zero numbers in a
series of 10 numbers. Start
nzd 0,
i=1
repeat till 4 ,
till i=11
enter d
d=0 nzd nzd + 1
i i+1
Print nzd
stop
4

Draw a flowchart to find the sum of the first 50
natural numbers
Draw a flowchart for computing factorial of N
EXERCISES
Write an algorithm and draw a flow chart for the following problems
1. Read a number N and print all its divisors.
2. Compute the sum of the digits of any given number
3. Find the sum of given N numbers.
4. Sum of squares of integers from 1 to 50
5. Print the Message Hello on the Screen.
6. Display a Triangle of * on the screen.
7. Perform the different arithmetic Operations.
8. Evaluate the area of the circle Area = Pi * R*R
9. Convert the time in seconds to hours, minutes and seconds. (1 hr =3600 sec).
10. Find the sum of the digits of a four-digit number (ex 1234 sum=10).
11. Convert temperature given in Fahrenheit to Centigrade and Centigrade to
Fahrenheit (C=5/9(F-32)).
12. Converting distance in mm to cm, inch, feet (1 cm =10mm, 1inch=2.5cm, 1 feet
=12 inches).
13. Compute n
th
Fibonacci no.
14. Generate Fibonacci series up to n.
15. Covert binary number to decimal.
16. Convert decimal number (Positive) to binary.

Das könnte Ihnen auch gefallen