C++C++17C++20Learn C++NumericsSyntax

How To Compute The Greatest Common Divisor And Least Common Multiple in C++?

The C++ 17 standard brings us a lot of useful methods, templates, numerics, and algorithms. Two of the great numeric functions are std::gcm and std::lcm which are defined in the <numeric> header that computes the greatest common divisor and least common multiple of two integers. In this post, we learn what std::gcm and std::lcm are, and how can we use them in modern C++. What is std::gcm…
Read more