How could find multiples of a given number N ?

170 次查看(过去 30 天)
The input is taken from the user.

采纳的回答

Torsten
Torsten 2016-3-29
"input" is a multiple of N if and only if mod(input,N)=0.
Best wishes
Torsten.

更多回答(2 个)

ilker melik
ilker melik 2020-7-30
编辑:ilker melik 2020-7-30
function c = finding_multipliers(y) % y is the number that you are looking for.
count = 0;
n = 1;
while n < y
if mod(y,n) == 0
count = count + 1;
c(count,1) = n;
end
n = n + 1;
end
This can be a helpful function.

RINU BENNY
RINU BENNY 2022-4-26
n=input('enter the number whose multiple is needed'); m=input('enter the range of multiples needed'); for i=0:m if mod(i,n)==0 disp(i); end end

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by