How to find gcd using function?

How to write a program using function to find the greatest common division?
Does anyone has any ideas?

1
2
3
4
5
6
7
8
9
int gcd(int n, int m)
{
   int gcd = 1;
   
   
   
   
   return gcd;
}


Read about Euclid's algorithm http://en.wikipedia.org/wiki/Greatest_common_divisor.

And little reminder:
In C++ to find a remainder use % operator, and to divide use / operator.
Topic archived. No new replies allowed.