Unit 1 - I Algorithms and Flowcharts v1.4
Unit 1 - I Algorithms and Flowcharts v1.4
Lecture Notes:
C Programming
UNIT 1 Part 1
Algorithm and Flowchart
Ver.1.4
Table of Contents
1. Algorithm .................................................................................................................................................. 3
2. Flowchart .................................................................................................................................................. 3
3.3 Flowchart for computing area of a triangle given three sides: ...................................................... 7
3.9 Algorithm and Flowchart for finding factorial of given number ................................................ 12
1. Algorithm
Def 1: Step-by-step procedure to solve a problem using computer is called algorithm.
Def 2: In Computer Science, A finite sequence of unambiguous steps to solve a problem is called an
algorithm.
Example 2: Algorithm for checking a given number is +ve or –ve (Assume 0 is positive)
Step 1: Start
Step 2: Input the number and assign it to variable X.
Step 3: Check if X is less than 0, then display “ The given number is –ve”. Otherwise display “ The
given number is +ve”
Step 4: Stop
2. Flowchart
Def: Pictorial representation of an algorithm is known as flowchart.
2 Stop:
3: Input/Output Operations:
4: Processing:
7. Flow line:
8. Connector:
9. Repeating Operation:
Flowchart:
Exercise 1: Write the algorithm and flowchart for computing the area of a circle.