diff options
Diffstat (limited to '1034/CH1/EX1.1/example1.sce')
-rwxr-xr-x | 1034/CH1/EX1.1/example1.sce | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/1034/CH1/EX1.1/example1.sce b/1034/CH1/EX1.1/example1.sce new file mode 100755 index 000000000..bd999a073 --- /dev/null +++ b/1034/CH1/EX1.1/example1.sce @@ -0,0 +1,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)
|