summaryrefslogtreecommitdiff
path: root/37/CH7/EX7.1/s1.sci
diff options
context:
space:
mode:
Diffstat (limited to '37/CH7/EX7.1/s1.sci')
-rwxr-xr-x37/CH7/EX7.1/s1.sci17
1 files changed, 17 insertions, 0 deletions
diff --git a/37/CH7/EX7.1/s1.sci b/37/CH7/EX7.1/s1.sci
new file mode 100755
index 000000000..5843c0424
--- /dev/null
+++ b/37/CH7/EX7.1/s1.sci
@@ -0,0 +1,17 @@
+function[]=search(a,n,ele)
+ i=1;
+ j=0;
+ for i=1:n
+ if(a(i)==ele)
+ printf("Found %d AT %d\n",ele,i);
+ j=1;
+ end
+ end
+ if(j==0)
+ disp("%d NOT FOUND",ele);
+ end
+endfunction
+//Calling Routine:
+a=[2 33 22 121 23 233 222]
+disp(a,"Given array");
+search(a,7,23)