How could find multiples of a given number N ?
138 ビュー (過去 30 日間)
古いコメントを表示
The input is taken from the user.
0 件のコメント
採用された回答
Torsten
2016 年 3 月 29 日
"input" is a multiple of N if and only if mod(input,N)=0.
Best wishes
Torsten.
その他の回答 (2 件)
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
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
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!