Algorithm On Finding Sum of A Series
Algorithm On Finding Sum of A Series
Presented by-
Contents
1
Comparative Analysis – AP Vs GP Vs HP
Arithmetic Geometric Harmonic
Progression Series Progression Series Progression Series
A sequence of The geometric A sequence of
numbers is called progression series is numbers is called
an arithmetic a sequence of a Harmonic
progression if the numbers in which progression if the
difference between each term of the reciprocal of the
any two consecutive progression is a terms of a sequence
terms is constant. constant multiple of are in arithmetic
the previous term. progression.
Example- Example- Example-
1,2,3,4,5,6… 3,9,27,81,243…. 1/5,1/10,1/15,1/20…
2
Problem Statement for this Assignment
To solve this problem, we have chosen the following
G.P. series :- 1,2,2,3,3,3,4,4,4,4…….n
Now, if n = 5, then
The series will be: 1,2,2,3,3,3,4,4,4,4,5,5,5,5,5
Thus, the sum of the series will be:
1+2+2+3+3+3+4+4+4+4+5+5+5+5+5 = 55
3
Algorithm
1. START
2. Declare variable n, sum and i
3. Read the value of n
4. Assign sum = 0 and i = 1
5. sum = sum + (i*i)
6. i = i+1
7. If (i<=n), return to step no. 5
8. Print sum
9. STOP
4
Flowchart
START
Read n
sum=0, i=1
sum=sum+(i*i)
i=i+1
Is i<=n Y
N
print sum
STOP
5
THANK YOU