Question: Please answer in c++ and please explain the program in steps. Thank you You are given a pair of integers (x,y). You may perform either

Please answer in c++ and please explain the program in steps. Thank you

You are given a pair of integers (x,y). You may perform either of the two operations below,in any order, zero or more times.

1. (x,y) -> (x+y,y) 2. (x,y) -> (x,y+x)

For example, you can start with (1, 4), change it to (5, 4), change that to (5, 9), and then change that again to (5, 14). You are given four integers: a, b, c, and d. Return Yes (without quotes) if it is possible to start with the pair (a, b) and end with the pair (c, d). Otherwise, return No.

Method signature: string function(int a, int b, int c, int d)

Input Four integers in separate lines.

Output One string Yes or No.

Constraints

1 a,b,c,d 1000

Sample Input 1 4 5 9

Sample Output Yes

Explanation (1, 4) -> (5, 4) -> (5, 9) .

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!