Question: Need help in C++, comments and outputs please 1) The greatest common divisor of integers x and y is the largest integer that evenly divides

Need help in C++, comments and outputs please

1) The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. Write a recursive function gcdthat returns the greatest common divisor of x and y. The gcdof xand yis defined recursively as follows. If yis 0 the answer is x; otherwise gcd(x, y)is gcd(y, x%y).

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!