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 /55/CH11/EX11.6/11ex6.sci | |
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 '55/CH11/EX11.6/11ex6.sci')
-rwxr-xr-x | 55/CH11/EX11.6/11ex6.sci | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/55/CH11/EX11.6/11ex6.sci b/55/CH11/EX11.6/11ex6.sci new file mode 100755 index 000000000..34789cbc5 --- /dev/null +++ b/55/CH11/EX11.6/11ex6.sci @@ -0,0 +1,36 @@ +disp('Euclidean Algorithm')
+a=[540,168,36,24];
+b=[168,36,24,12];
+for i=1:4
+V=int32([a(i),b(i)]);
+thegcd=[];
+thegcd(i)=gcd(V);
+disp(thegcd(i))
+end
+
+function []=myf(dividend,divisor)
+quotient=floor(dividend/divisor);
+rem=modulo(dividend,divisor);
+k=quotient*divisor+rem;
+disp(k)
+if(rem~=0) then
+ myf(divisor,rem)
+end
+endfunction
+
+myf(540,168)
+
+disp('for the equation 540*x+168*y=12,we are given')
+a=540;
+b=168;
+c=24;
+d=36;
+d=a-3*b; //Eqn (1)
+c=b-4*d; //Eqn (2)
+k=d-1*c; //Eqn (3)
+5*d-1*b; //Eqn (4)
+k=d-b+4*d; //substituting value of c in Eqn (3) from Eqn (2)
+r=5*a-16*b;
+if(r==k) then
+ disp('x=5 and y=16');
+end
\ No newline at end of file |