Question: Hi there, I need help in this coding. Any idea how to add a counter to count the number of times the program runs to

Hi there, I need help in this coding. Any idea how to add a counter to count the number of times the program runs to get it's GCD?

This program is a GCD algorithm.

a = int(input("Enter first number : "))

b= int( input("Enter second number : "))

def RecursionGCD(a,b,count=0):

if(b==0): #base

c=A%B;

A=B;

B=c;

count+=1;

return a #case

else:

return RecursionGCD(b,a%b) #recursion

a = int(input("Enter first number : "))

b= int( input("Enter second number : "))

# prints results

print ("The gcd of the 2 numbers is : ",end="")

print (RecursionGCD(a,b))

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!