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++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question

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*)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning