Sum of the series Kn + ( K ( n | Function to return sum ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int sum ( int k , int n ) { int sum = pow ( k , n + 1 ) - pow ( k - 1 , n + 1 ) ; return sum ; } int main ( ) { int n = 3 ; int K = 3 ; cout << sum ( K , n ) ; }