C++ Write a recursive program that finds out if n is a Fibonacci number or not. The Fibonacci numbers are 0 1 1 2 3 5 8 13 21 … Your program should have the following interface: Enter a number (enter a negative number to quit): 14 !!!!! Sorry14 is not a Fibonacci number Enter a number (enter a negative number to quit): 13 Yes, you got it, 13 is a Fibonacci number Enter a number (enter a negative number to quit): 22 !!!!! Sorry 22 is not a Fibonacci number Enter a number (enter a negative number to quit): 23 !!!!! Sorry 23 is not a Fibonacci number Enter a number (enter a negative number to quit): 21 Yes, you got it, 21 is a Fibonacci number Enter a number (enter a negative number to quit): -1 (*Thanks – Have a good Day*)
C++
Write a recursive
0 1 1 2 3 5 8 13 21 …
Your program should have the following interface:
Enter a number (enter a negative number to quit): 14
!!!!! Sorry14 is not a Fibonacci number
Enter a number (enter a negative number to quit): 13
Yes, you got it, 13 is a Fibonacci number
Enter a number (enter a negative number to quit): 22
!!!!! Sorry 22 is not a Fibonacci number
Enter a number (enter a negative number to quit): 23
!!!!! Sorry 23 is not a Fibonacci number
Enter a number (enter a negative number to quit): 21
Yes, you got it, 21 is a Fibonacci number
Enter a number (enter a negative number to quit): -1
(*Thanks – Have a good Day*)
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images