According to Donald Knuth in "The Art Of Computer Programming", the following is how to find the greatest common divisor of two positive numbers, m and n, using Euclid's Algorithm.


  
  Divide m by n and let r be the remainder.
  If r is 0, n is the answer; if r is not 0, continue to step 3.
  Set m = n and n = r. Go back to step 1.
  


Below is my implementation of this algorithm.

#include &lt;stdio.h&gt;

int greatestCommonDivisor(int m, int n)
{
    int r;

    /* Check For Proper Input */
    if((m == 0) || (n == 0))
        return 0;
    else if((m &lt; 0) || (n &lt; 0))
        return -1;

    do
    {
        r = m % n;
        if(r == 0)
            break;
        m = n;
        n = r;
    }
    while(true);

    return n;
}

int main(void)
{
    int num1 = 600, num2 = 120;
    int gcd = greatestCommonDivisor(num1, num2); 

    printf("The GCD of %d and %d is %d\n", num1, num2, gcd);

    getchar();
    return 0;
}


Though it appears to work just fine, it doesn't seem to be as elegant as I'd like, especially in the do-while loop.  Also, the while(true) seems dangerous, though I'm pretty confident that r will be reduced to 0 eventually and we'll break out of the loop.

Do you have any suggestions on either making the code more elegant or robust?


Question: Who to involve when making user tasks/scenarios for a usability test?
Answer: The most important types of people to bring in are those who know the research for your end user very well, preferably people who can remain unbiased about the product and focus more on the user needs. It is good to let the some of the stakeholders know what you are doing and provide some feedback, but be careful not to give them too much control; stakeholders are attached to the product and are more likely to accidentally bias the testing process to achieve the results they are looking for.

The biggest piece of advice I would recommend that you should limit the amount of people who have a say in the process because of one common issue: the more people you have involved, the more subjective your research is likely to become. Each department has their own objectives which can quickly muddle what should be an unbiased UX process. If your research has been done well (which I'm sure it has) all you should need it some quick fact checking from no more than 3-5 people total.