Sum of the series 0.6 , 0.06 , 0.006 , 0.0006 , ... to n terms | CPP program to find sum of 0.6 , 0.06 , 0.006 , 0.0006 , ... to n terms ; function which return the the sum of series ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float sumOfSeries ( int n ) { return ( 0.666 ) * ( 1 - 1 / pow ( 10 , n ) ) ; } int main ( ) { int n = 2 ; cout << sumOfSeries ( n ) ; }