You are on page 1of 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
Terminal Input/output Processing Looping

Symbol

Function
To indicate begin and end in a flowchart Input or output data or information Calculations, data manipulation or information processing Processes a group of instructions repeatedly

Decision
Predefined process

A comparison or decision which leads the flow of control to take alternate paths
Group of operations not listed in the particular flowchart

Connector
Flow Direction

An entry from or an exit to another part in a flowchart


Represents the direction of flow of control

Flowchart to find the largest of 3 numbers


Start

Read A, B, C

A>B

A>C Print B

B>C Print C

Print A

Print C

Stop

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 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 B read roll no , code , height

Y
t_b_h t_b_h + height t_b t_b + 1 n1 n1 + 1

code =1

N
t_g_h t_g_h + height t_g t_g +1 n1 n1+1

A a_v_b t_b_h / t_b B n1=n a_v_g t_g_h / t_g

Print a_v_b , a_v_g

Stop

Start Read n , num1

To find largest of n numbers using 2 memory locations num1 and num2

repeat till 4 , till n = 1 read num2

num2>num1 n n-1
4

num1 num2

Print num1

stop

Q)

Draw a flowchart to count the number of non-zero numbers in a Start series of 10 numbers.
nzd 0, i=1 repeat till 4 , till i=11

enter d
d=0 i i+1 4 Print nzd nzd nzd + 1

stop

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 nth Fibonacci no. 14. Generate Fibonacci series up to n. 15. Covert binary number to decimal. 16. Convert decimal number (Positive) to binary.

You might also like