Greatest common divisor: Difference between revisions

Content deleted Content added
Add Verilog GCD
Line 542:
 
=={{header|C++}}==
<lang cpp>#include <iostream>
Copied from [http://rosettacode.org/wiki/Least_common_multiple least common multiple page] for the sake of completeness.
#include <numeric>
 
int main() {
std::cout << "and theThe greatest common divisor of 12 and 18 is " << boost::mathstd::gcd( 12 , 18 ) << " !\n" << std::endl ;
}</lang>
 
{{libheader|Boost}}
<lang cpp>#include <boost/math/common_factor.hpp>
#include <iostream>
 
int main( ) {
std::cout << "The leastgreatest common multipledivisor of 12 and 18 is " << boost::math::gcd(12, 18) << "!\n";
boost::math::lcm( 12 , 18 ) << " ,\n"
<< "and the greatest common divisor " << boost::math::gcd( 12 , 18 ) << " !" << std::endl ;
return 0 ;
}</lang>
 
{{out}}
<pre>The leastgreatest common multipledivisor of 12 and 18 is 36 ,6!</pre>
and the greatest common divisor 6 !
</pre>
 
=={{header|c sharp|C#}}==