Unit 1 - I Algorithms and Flowcharts
Unit 1 - I Algorithms and Flowcharts
Flowchart
C PROGRAMMING ➔ UNIT 1
Algorithm 2
repeat
False as long
as the
conditio
n is true
True
statements
❑ Connector
Flow chart for addition of two nos. 16
numbers:
Computing Simple Interest 17
❑ Algorithm
Step 1: Start
Step 2: Input principle p, rate of interest r, and time
period t.
Step 3: Compute Simple interest si = (p*r*t)/100
Step 4: Display simple interest si
Step 5: Stop
Computing Simple Interest 18
❑ Flowchart
Area of a triangle(given 3 sides) 19
❑ Flowchart
Extracting Unit’s digit of a given number: 20
❑ Flowchart
Larger of two numbers 21
❑ Flowchart
check if a given number is +ve or –ve or zero22
❑ Flowchart
Sum of first n +ve numbers 23
❑ Algorithm
n = 5,
Step 1: Start
Step 2: Input value of n. i sum
Step 3: Initialize i = 1, sum = 0
1 0
Step 4: Repeat as long as i<= n 2 1
i. sum = sum + i 3 3
ii. i = i + 1 4 6
Step 6: Stop. 6 15
Sum of first n +ve 24
numbers
Factorial of given number 25
❑ Algorithm
1. Start
2. Input the value of n
3. Initialize i = 1, fact =1
4. Repeat the steps as long as i<=n is true
I. fact = fact *i
II. i = i+1
5. Display factorial value fact
6. Stop.
Factorial of given 26
number (Flowchart)