The algorithm states that, for computing the GCD of two positive integers and , if and are equal, . Otherwise if . There are a few optimizations that can be made to the above logic to arrive at a more efficient implementation.
Given the starter code, you need to complete a function body that returns the GCD of two given integers and .
The task of reading in input and printing the output will be handled by us.
Programming Language Support
At this point of time, we have a template for Scala. This means that we provide the code required to accept the input and display the output.
One line of input containing space separated integers.
Output one integer, the GCD of the two given numbers.