Write a program that will find the smallest number that is divisible (without remainder) of each of the numbers 1 to 10.

2 ビュー (過去 30 日間)
Thank You

回答 (3 件)

José-Luis
José-Luis 2017 年 9 月 1 日
編集済み: José-Luis 2017 年 9 月 1 日
disp('2520')
Or did you expect people to do your homework?
  3 件のコメント
José-Luis
José-Luis 2017 年 9 月 1 日
編集済み: José-Luis 2017 年 9 月 7 日
Oh, I can try to help, and I'll keep on commenting, thank you very much.
Asking for someone else to do something that is obviously homework, where you have put no effort, doesn't really motivate, and is in fact considered cheating.
I also fail to see a specific Matlab question.
Furthermore:
Just for kicks, you could submit this:
a = (1:10).';
dummy = perms(a.');
dummy = cumprod(dummy,2);
to_keep = dummy;
dummy = bsxfun(@rdivide,dummy,reshape(a.',1,1,10));
dummy = dummy == floor(dummy);
dummy = sum(dummy,3) == 10;
column = sum(dummy);
column = find(column > 0, 1);
idx = dummy(:,column);
result = min(to_keep(idx,column))
I just love the woefully inefficient. But hey, there are no loops.
And the logic should help.
John D'Errico
John D'Errico 2017 年 9 月 2 日
@Scott: if you can't do your own homework, then don't bother asking someone else to do it for you. :)

サインインしてコメントする。


Star Strider
Star Strider 2017 年 9 月 1 日
Since ‘remainder’ is the important requirement, search the MATLAB (link) online help for that term.

Image Analyst
Image Analyst 2017 年 9 月 1 日

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by