clear; clc;

x = randi(10, 1, 5)

n = length(x);
for i = 1 : n
    k = i;
    for j = i + 1 : n
        if x(j) < x(k)
            k = j;
        end
    end
    tmp = x(i);
    x(i) = x(k);
    x(k) = tmp;
end
x