how to sort in increasing order using loop?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
for i=1:6
A(i)=input('')
end
for i=1:6
for j=1:5
if A(j)>=A(j+1)
B=A(j);
A(j)=A(j+1);
A(j+1)=B;
end
end
end
6 Commenti
Jan
il 17 Dic 2017
@baiti: It seems like you have a problem running this code. Then it would be useful, if you mention what the problem is. "it wont work on my matlab" does not allow to reconsider, why you are not satisfied.
Risposte (1)
rohan hazarika
il 18 Set 2020
for i=1:6
A(i)=input('')
end
for i=1:6
for j=1:5
if A(j)>=A(j+1)
B=A(j);
A(j)=A(j+1);
A(j+1)=B;
end
end
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!