text: Program to print the series 1 , 3 , 4 , 8 , 15 , 27 , 50 â €¦ till N terms | C ++ implementation to print the N terms of the series whose three terms are given ; Function to print the series ; Generate the ith term and print it ; Driver Code ; Function Call
code: #include " bits / stdc + + . h " NEW_LINE using namespace std ; void printSeries ( int n , int a , int b , int c ) { int d ; if ( n == 1 ) { cout << a << " ▁ " ; return ; } if ( n == 2 ) { cout << a << " ▁ " << b << " ▁ " ; return ; } cout << a << " ▁ " << b << " ▁ " << c << " ▁ " ; for ( int i = 4 ; i <= n ; i ++ ) { d = a + b + c ; cout << d << " ▁ " ; a = b ; b = c ; c = d ; } } int main ( ) { int N = 7 , a = 1 , b = 3 ; int c = 4 ; printSeries ( N , a , b , c ) ; return 0 ; }