Find the sum of series 0. X + 0. XX + 0. XXX + ... upto k terms | C ++ program for sum of the series 0. x , 0. xx , 0. xxx , ... upto k terms ; function which return the sum of series ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float sumOfSeries ( int x , int k ) { return ( float ( x ) / 81 ) * ( 9 * k - 1 + pow ( 10 , ( -1 ) * k ) ) ; } int main ( ) { int x = 9 ; int k = 20 ; cout << sumOfSeries ( x , k ) ; return 0 ; }