Greatest common divisor: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 312:
{!} 9973</pre>
 
=={{header|C}}/{{header|C++}}==
===Iterative Euclid algorithm===
<lang c>int
Line 365:
return u * k;
}</lang>
 
=={{header|C++}}==
Copied from [http://rosettacode.org/wiki/Least_common_multiple least common multiple page] for the sake of completeness.
{{libheader|Boost}}
<lang cpp>#include <boost/math/common_factor.hpp>
#include <iostream>
 
int main( ) {
std::cout << "The least common multiple of 12 and 18 is " <<
boost::math::lcm( 12 , 18 ) << " ,\n"
<< "and the greatest common divisor " << boost::math::gcd( 12 , 18 ) << " !" << std::endl ;
return 0 ;
}</lang>
 
{{out}}
<pre>The least common multiple of 12 and 18 is 36 ,
and the greatest common divisor 6 !
</pre>
 
=={{header|c sharp|C#}}==
9

edits