Question: Exercise 5.4.2. For experts: Revise the gcf function so that it uses an iterative (loop- based) approach. Each cycle through the loop should stop if
Exercise 5.4.2. For experts: Revise the gcf function so that it uses an iterative (loop- based) approach. Each cycle through the loop should stop if B is zero; otherwise, it should set new values for A and B and then continue. Youll need a temporary
variabletempto hold the old value of B for a couple of lines: temp = b, b = a%b, and a = temp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
