Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
C Programming for sum of the series 0.6, 0.06, 0.006, 0.0006, ...to n terms
The given series 0.6, 0.06, 0.006, 0.0006, ... is a geometric progression where each term is obtained by dividing the previous term by 10. To find the sum of this series, we apply the formula for the sum of a geometric progression where the common ratio r
Syntax
Sum = a * (1 - r^n) / (1 - r) where a = first term, r = common ratio, n = number of terms
Mathematical Formula
For the given series −
First term (a) = 0.6 = 6/10 Common ratio (r) = 0.1 = 1/10 Sum = (6/10) * [1 - (1/10)^n] / (1 - 1/10) Sum = (6/10) * [1 - (1/10)^n] / (9/10) Sum = (6/9) * [1 - (1/10)^n] Sum = (2/3) * [1 - (1/10)^n]
Example
Here's a C program to calculate the sum of the series for n terms −
#include <stdio.h>
#include <math.h>
int main() {
int n = 6;
double sum = (2.0/3.0) * (1 - 1.0/pow(10, n));
printf("Number of terms: %d<br>", n);
printf("Sum of series: %.6f<br>", sum);
// Display the series terms
printf("Series: ");
for(int i = 1; i <= n; i++) {
printf("%.3f", 6.0/pow(10, i));
if(i < n) printf(" + ");
}
printf(" = %.6f<br>", sum);
return 0;
}
Number of terms: 6 Sum of series: 0.666666 Series: 0.600 + 0.060 + 0.006 + 0.001 + 0.000 + 0.000 = 0.666666
Key Points
- The series is a geometric progression with first term a = 0.6 and common ratio r = 0.1
- The sum approaches 2/3 (? 0.666667) as n approaches infinity
- Each term is exactly 1/10th of the previous term
Conclusion
The sum of the geometric series 0.6 + 0.06 + 0.006 + ... for n terms can be calculated using the GP sum formula. As the number of terms increases, the sum converges to 2/3.
Advertisements
