summaryrefslogtreecommitdiff
path: root/1034/CH1/EX1.1/example1.sce
blob: bd999a0737b3b6939c0469dc330a305d422d4d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//to do sorting of nos. contained in a list
function[]=sorting(a)
    i=1;
    [j,k]=size(a);
    j=i;
    for i=1:k-1
        for j=i:k
            if a(i)>a(j) then
            z=a(i);
            a(i)=a(j);
            a(j)=z;
        end
    end
end
for i=1:k
    disp(a(i));
end

funcprot(0);
endfunction
    //callin routine
    a=[5 7 45 23 78]
    sort=sorting(a)