fbpx

C++: Greatest Common Denominator

Bjarne-stroustrup
 

int Find_Greatest_Common_Denominator(int x, int y)
//Function that finds the Greatest Common Denominator ("GCD") between 2 integers
{ 
	int a;
	if(x==0)
		cout << y << endl;
	if(y==0)
		cout << x << endl;
	if(x==y)
		cout << x << endl;
	if(x>y)
	{  
		a = x - y;  
		return Find_Greatest_Common_Denominator(a, y); 
	}
	if(y>x)
	{  
		a = y - x;  
		return Find_Greatest_Common_Denominator(x, a); 
	} 
}

Our team found a curious site for our readers that are fans of online gaming, a rather exciting site that provides the latest gaming technology. Casinodots.com is the site, they compile the best reviews of MGA casino utan svensk licens sites. This site might pique your curiosity and you can win extra money!