Minimum operations required to make two numbers equal | Python program to find minimum operations required to make two numbers equal ; Function to return the minimum operations required ; Keeping B always greater ; Reduce B such that gcd ( A , B ) becomes 1. ; Driver code
import math NEW_LINE def minOperations ( A , B ) : NEW_LINE INDENT if ( A > B ) : NEW_LINE INDENT swap ( A , B ) NEW_LINE DEDENT B = B // math . gcd ( A , B ) ; NEW_LINE return B - 1 NEW_LINE DEDENT A = 7 NEW_LINE B = 15 NEW_LINE print ( minOperations ( A , B ) ) NEW_LINE