as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
develop an algorithm to calculate the greatest common divisor of two numbers.
user
here is an algorithm to calculate the greatest common divisor (gcd) of two numbers:
1. start by making sure the two numbers are both positive.
2. divide the larger number by the smaller number and get the remainder.
3. if the remainder is 0, then the smaller number is the gcd.
4. if the remainder is not 0, then the smaller number becomes the new dividend and the remainder becomes the new divisor.
5. repeat steps 2 through 4 until the remainder is 0.
assistant