Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Why get i this result?

2 visualizzazioni (ultimi 30 giorni)
Said BOUREZG
Said BOUREZG il 20 Apr 2017
Chiuso: MATLAB Answer Bot il 20 Ago 2021
>> 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 Commenti
John D'Errico
John D'Errico il 20 Apr 2017
The 1 million'th person to ask this, or an equivalent question.

Risposte (0)

Questa domanda è chiusa.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by