diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1332/CH1/EX1.24/1_24.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1332/CH1/EX1.24/1_24.sce')
-rwxr-xr-x | 1332/CH1/EX1.24/1_24.sce | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/1332/CH1/EX1.24/1_24.sce b/1332/CH1/EX1.24/1_24.sce new file mode 100755 index 000000000..3495a2234 --- /dev/null +++ b/1332/CH1/EX1.24/1_24.sce @@ -0,0 +1,36 @@ +//Example 1.24
+//Multiplication
+//Page no. 18
+clc;clear;close;
+
+function [x1]=mul(x,y)
+ for i=1:8
+ x1(1,i)=0
+ end
+ printf('Multiplication of %.4i and %.4i = ',x,y)
+ x=x*y;
+ c=0;
+ for i=8:-1:1
+ x=x/10;
+ xd=floor((x-fix(x))*10+0.1)
+ if c==1 then
+ if xd==0 then
+ x1(1,i)=1;c=0
+ elseif xd==1
+ x1(1,i)=0;
+ c=1;
+ elseif xd==2
+ x1(1,i)=1;c=1;
+ end
+ else
+ if xd==0 | xd==1 then
+ x1(1,i)=xd;c=0
+ elseif xd==2
+ x1(1,i)=0;
+ i=i-1;c=1;
+ end
+ end
+ end
+ disp(x1)
+endfunction
+mul(1110,1011);
\ No newline at end of file |