I keep getting an error everytime I run my code that says:
[out] = smallest_multiple(6) Error using gcd (line 23)Inputs must be floats, namely single or double.Error in smallest_multiple (line 4) out = (out * i) / (gcd(out,i));
Is 6 not a single?
Here is my code:
function [out] = smallest_multiple(n) out = uint64(1);for i = 1 : n out = (out * i) / (gcd(out,i));end if out >= intmax('uint64') out = uint64(0); end end
Best Answer