Find the sum of the series 1 + 11 + 111 + 1111 + ... . . upto n terms | C ++ program to find the sum of the series 1 + 11 + 111 + 1111 + ... . ; Function for finding summation ; Driver Code
#include <bits/stdc++.h> NEW_LINE int summation ( int n ) { int sum ; sum = ( pow ( 10 , n + 1 ) - 10 - ( 9 * n ) ) / 81 ; return sum ; } int main ( ) { int n = 5 ; printf ( " % d " , summation ( n ) ) ; return 0 ; }