2

I need the greatest common divisor between two numbers in the smart contract. I tried:

int gcd = __gcd(num1, num2);

num1 and num2 are two numbers. When the smart contract is compiled, its generating error:

error: use of undeclared identifier '__gcd'

I also tried std::__gcd but no use. It seems EOS doesn't support __gcd. Please help.

1 Answer 1

3

You should have #include <numeric> to use std::gcd in your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.