junelsingh7 junelsingh7
  • 14-06-2021
  • Computers and Technology
contestada

WAP to print given series by using sub procedure 2,3,5,8,13,...........,20th term.​

Respuesta :

buingocmyan buingocmyan
  • 14-06-2021

Answer: c++

int fibonacci(int n) {

if (n < 0) {

return -1;

} else if (n == 0 || n == 1) {

return n;

} else {

return fibonacci(n - 1) + fibonacci(n - 2);

}

}

int main() {

int i;

for (i = 0; i < 20; i++) {

cout << fibonacci(i) << " ";

}

}

Explanation:

this is fibonacci

Answer Link

Otras preguntas

Simplify if possible 75/100
Which of the following is the most electronegative element? a. He b. I c. N d. O e. C
If a substance conducts heat easily, it is considered to be agood insulator.bad substance.good conductor.poor conductor.
Alaine has 1 gallon of paint. She is going to pour it into a paint tray that measures 10 inches wide, 12 inches long, and 5 cm deep.(1 gallon = 231 in3, 1 inch
What is 5/8 divided by 5/12?
x squared=2y make X the subject
what are these from least to greatest 0.3,0.13,0.19,0.31
What is the slope-intercept form of 9x +3y −6 = 0?
Cincinnati's major league baseball team is the Reds. What was the greatest historical significance of this team that happened in 1869? PLEASE HELP!!! D:
The odometer in Mr.Washington car does not work correctly. The odometer recorded 13.2 miles for his last trip to the hardware store, bit he knows the distance t