25.03.2015 Views

Lista 04 - UFMG

Lista 04 - UFMG

Lista 04 - UFMG

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

for C = 1 : 10<br />

numero(C) = input('Digite o numero de inscricao do corredor: ');<br />

tempo(C) = input('Digite o tempo de corrida deste corredor: ');<br />

end<br />

for C = 1 : 9<br />

for I = 1 : 10 - C<br />

if (tempo(I) > tempo(I + 1))<br />

auxiliar = tempo(I);<br />

tempo(I) = tempo(I + 1);<br />

tempo(I + 1) = auxiliar;<br />

aux = numero(I);<br />

numero(I) = numero(I + 1);<br />

numero(I + 1) = aux;<br />

end<br />

end<br />

end<br />

for C = 1 : 10<br />

fprintf(1,’O %d. foi o de numero %d com o tempo de %f\n',C,numero(C),tempo(C));<br />

end<br />

<strong>UFMG</strong> – ICEx – DCC – Programação de Computadores – 2º. Sem 2005 – David Menoti 59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!