GCD help

can someone tell me what is the code for finding the GCF of two integers or Euclid's Algorithm, can you please make it as simple as possible. Thanks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
int GCD( int a, int b )
{
	a = std::abs( a );
	b = std::abs( b );

	while ( b )
	{
		int tmp = a % b;
		a = b;
		b = tmp;
	}

	return ( a );
}
great, thanks !
Topic archived. No new replies allowed.