Question: Develop a GUI as below that takes in two positive integers on the left. An = button is provided. Once it is clicked, the smallest

Develop a GUI as below that takes in two positive integers on the left. An = button is provided. Once it is clicked, the smallest positive integers are shown on the right. Basically, let the input numbers be divided by their gcd (greatest common divisor). Declare gcd to be a local variable. Apply loops instead of recursion

Three examples are shown below to compute the gcd.

Example 1: for 36 / 48 48 % 36 = 12 // bigger value 48 mods the smaller value 36. 36 % 12 = 0 // the new bigger value 36 mods the smaller value 12. So, 12 is the gcd. // When the mod result is 0, the smaller value is the gcd. We have 36 / 48 = 3 /4.

Example 2: for 124 / 64 124 % 64 = 60 64 % 60 = 4 60 % 4 = 0 So, 4 is the gcd. We have 124 / 64 = 31 / 16.

Example 3: for 7 / 9 9 % 7 = 2 7 % 2 = 1 2 % 1 = 0 So, 1 is the gcd. We have 7 / 9 = 7 / 9.

Frame Title 36 48

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!