MATLAB: How to display the minimum number from a row vector

for loopfprintfif statementMATLAB

I have to find the smallest number divisible by 1 to 10 with a remainder of 0 for each number. The code that I have works but still gives me more than one answer.
m = 1:10;
for x = 1:10000
if mod(x,m) == 0
S = min(x);
fprintf('%i ', S)
end
end
Thank you!

Best Answer

You should add in
break;
after your fprintf()
Related Question