Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Why get i this result?

1 visualización (últimos 30 días)
Said BOUREZG
Said BOUREZG el 20 de Abr. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 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 comentarios
John D'Errico
John D'Errico el 20 de Abr. de 2017
The 1 million'th person to ask this, or an equivalent question.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by