Find the sum of series 3 , | C ++ program to find sum upto N term of the series : 3 , - 6 , 12 , - 24 , ... . . ; calculate sum upto N term of series ; Driver code
#include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; class gfg { public : int Sum_upto_nth_Term ( int n ) { return ( 1 - pow ( -2 , n ) ) ; } } ; int main ( ) { gfg g ; int N = 5 ; cout << g . Sum_upto_nth_Term ( N ) ; }