text: Tetranacci Numbers | A simple recursive CPP program to print the nth tetranacci numbers . ; Function to return the N - th tetranacci number ; base cases ; base cases ; base cases ; function to print the nth tetranacci number ; Driver code
code: #include <iostream> NEW_LINE using namespace std ; int printTetraRec ( int n ) { if ( n == 0 ) return 0 ; if ( n == 1 n == 2 ) return 1 ; if ( n == 3 ) return 2 ; else return printTetraRec ( n - 1 ) + printTetraRec ( n - 2 ) + printTetraRec ( n - 3 ) + printTetraRec ( n - 4 ) ; } void printTetra ( int n ) { cout << printTetraRec ( n ) << " ▁ " ; } int main ( ) { int n = 10 ; printTetra ( n ) ; return 0 ; }