Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why get i this result?

조회 수: 1 (최근 30일)
Said BOUREZG
Said BOUREZG 2017년 4월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
>> a = [10035.99];
>> k=[100 50 20 10 5 2 1 0.5 0.25 0.1 0.05 0.01];
% i must get b=[100 0 1 1 1 0 0 1 1 2 0 4] but ...see the end.
for i=1:length(k)
b(i)=fix(a/k(i))
a=mod(a,k(i))
end
b =
100
a =
35.9900
b =
100 0
a =
35.9900
b =
100 0 1
a =
15.9900
b =
100 0 1 1
a =
5.9900
b =
100 0 1 1 1
a =
0.9900
b =
100 0 1 1 1 0
a =
0.9900
b =
100 0 1 1 1 0 0
a =
0.9900
b =
100 0 1 1 1 0 0 1
a =
0.4900
b =
100 0 1 1 1 0 0 1 1
a =
0.2400
b =
100 0 1 1 1 0 0 1 1 2
a =
0.0400
b =
100 0 1 1 1 0 0 1 1 2 0
a =
0.0400
b =
100 0 1 1 1 0 0 1 1 2 0 3
a =
0.0100
  댓글 수: 2
John D'Errico
John D'Errico 2017년 4월 20일
The 1 million'th person to ask this, or an equivalent question.

답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by