Question: Write a function, just the function in C++ using recursion to calculate the nth Tribonacci number where n is a nonnegative integer . Use Prototype:
Write a function, just the function in C++ using recursion to calculate the nth Tribonacci number where n is a nonnegative integer .
Use Prototype: int tribonacci(int n);
The first three Tribonacci numbers are tribonacci(0) = 0, tribonacci(1) = 0, and and tribonacci(2) = 1.
Subsequent terms are calculated by adding the previous three. For example, the fourth tribonacci number would be 0+0+1 = 1.
The first eight Tribonacci numbers are 0, 0, 1, 1, 2, 4, 7, 13
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
