skip to main
|
skip to sidebar
De Archer
Pages
Home
Friday, November 5, 2010
GCD of two numbers in C++
// Iterative algorithm
int gcd(int a, int b)
{
int temp;
while(b)
{
temp = a % b;
a = b;
b = temp;
}
return(a);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Followers
About Me
Unknown
View my complete profile
No comments:
Post a Comment