Sum of the Series 1 / ( 1 * 2 ) + 1 / ( 2 * 3 ) + 1 / ( 3 * 4 ) + 1 / ( 4 * 5 ) + . . . . . | C ++ program to find the sum of given series ; function to find the sum of given series ; Computing sum term by term ; driver program to test above function
#include <bits/stdc++.h> NEW_LINE using namespace std ; double sumOfTheSeries ( int n ) { double sum = 0.0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += 1.0 / ( i * ( i + 1 ) ) ; return sum ; } int main ( ) { int n = 10 ; cout << sumOfTheSeries ( n ) ; return 0 ; }