summaryrefslogtreecommitdiff
path: root/A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb
diff options
context:
space:
mode:
authorPrashant S2020-04-14 10:25:32 +0530
committerGitHub2020-04-14 10:25:32 +0530
commit06b09e7d29d252fb2f5a056eeb8bd1264ff6a333 (patch)
tree2b1df110e24ff0174830d7f825f43ff1c134d1af /A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb
parentabb52650288b08a680335531742a7126ad0fb846 (diff)
parent476705d693c7122d34f9b049fa79b935405c9b49 (diff)
downloadall-scilab-tbc-books-ipynb-master.tar.gz
all-scilab-tbc-books-ipynb-master.tar.bz2
all-scilab-tbc-books-ipynb-master.zip
Merge pull request #1 from prashantsinalkar/masterHEADmaster
Initial commit
Diffstat (limited to 'A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb')
-rw-r--r--A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb1599
1 files changed, 1599 insertions, 0 deletions
diff --git a/A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb b/A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb
new file mode 100644
index 0000000..f897508
--- /dev/null
+++ b/A_Textbook_Of_Engineering_Physics_by_M_N_Avadhanulu/25-Digital_electronics.ipynb
@@ -0,0 +1,1599 @@
+{
+"cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 25: Digital electronics"
+ ]
+ },
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.10: binary_division.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"//example 25.10\n",
+"//binary division\n",
+"\n",
+"format('v',8);//changing the default precision to 8\n",
+"a=11001;//first number \n",
+"b=100;//second number\n",
+"A=bin21dec(a);//converting a in to decimal number \n",
+"B=bin21dec(b);//converting b in to decimal number \n",
+"S=A/B; //multiply the two decimal numbers\n",
+"temp=dec21bin(S);//converting the decimal product back to binary\n",
+"\n",
+"disp(temp,'quotient is');//displaying the final output"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.11: octal_additio.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.11\n",
+"//calculation of sum of two octal numbers\n",
+"\n",
+"//given values\n",
+"X='256';//divident\n",
+"Y='437';//divisor\n",
+"\n",
+"//calculation\n",
+"x=oct2dec(X);//decimal equivalent\n",
+"y=oct2dec(Y);//decimal equivalent\n",
+"z=x+y;\n",
+"Z=dec2oct(z);//binary equivalent\n",
+"disp(Z,'sum of the given octal numbers is')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.12: octal_multiplicatio.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.12\n",
+"//calculation of product of two octal numbers\n",
+"\n",
+"//given values\n",
+"X='15';//divident\n",
+"Y='24';//divisor\n",
+"\n",
+"//calculation\n",
+"x=oct2dec(X);//decimal equivalent\n",
+"y=oct2dec(Y);//decimal equivalent\n",
+"z=x*y;\n",
+"Z=dec2oct(z);//binary equivalent\n",
+"disp(Z,'product of the given octal numbers is')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.13: hexadecimal_additio.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.13\n",
+"//calculation of sum of hexadecimal numbers\n",
+"\n",
+"//given values\n",
+"X1='C';\n",
+"X2='A';\n",
+"X3='E';\n",
+"Y1='3';\n",
+"Y2='2';\n",
+"Y3='D';\n",
+"\n",
+"//calculation\n",
+"x1=hex2dec(X1);//decimal equivalent\n",
+"x2=hex2dec(X2);//decimal equivalent\n",
+"x3=hex2dec(X3);//decimal equivalent\n",
+"y1=hex2dec(Y1);//decimal equivalent\n",
+"y2=hex2dec(Y2);//decimal equivalent\n",
+"y3=hex2dec(Y3);//decimal equivalent\n",
+"z1=x1+y1;\n",
+"z2=x2+y2;\n",
+"z3=x3+y3;\n",
+"Z1=dec2hex(z1);//binary equivalent of sum\n",
+"Z2=dec2hex(z2);//binary equivalent of sum\n",
+"Z3=dec2hex(z3);//binary equivalent of sum\n",
+"disp(Z1,'sum of the first set of hexadecimal numbers is');\n",
+"disp(Z2,'sum of the second set of hexadecimal numbers is');\n",
+"disp(Z3,'sum of the thirdm set of hexadecimal numbers is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.14: binary_to_decimal_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.13\n",
+"//conversion of binary to decimal\n",
+"\n",
+"//given values\n",
+"X=10.101;//binary number\n",
+"\n",
+"//calculation\n",
+"Z=(1*2^1)+(0*2^0)+(1*2^-1)+(0*2^-2)+(1*2^-3);\n",
+"disp(Z,'decimal equivalent of the given binary number is')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.15: decimal_to_binary_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.15\n",
+"//conversion of decimal to binary\n",
+"\n",
+"//given values\n",
+"X=43;//decimal number\n",
+"\n",
+"//calculation\n",
+"Z=dec2bin(X);\n",
+"disp(Z,'binary equivalent of the given decimal number is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.16: decimal_to_binary_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;//clears the command window \n",
+"clear;//clears all the variables \n",
+"//example 25.16\n",
+"//decimal to binary conversion\n",
+"\n",
+"format('v',18);//changing the default prcision to 20 significant digits\n",
+"\n",
+"i=1;x=1;//flag bits\n",
+"\n",
+"dec=43.3125;//given decimal number which should be expressed in binary\n",
+"temp2=floor(dec);//separating integer part from the given number\n",
+"temp4=modulo(dec,1);//separating decimal part from the given number\n",
+"\n",
+"while(temp2>0)//storing each integer digit in vector for convenience\n",
+" p(i)=(modulo(floor(temp2),2))\n",
+" temp2=floor(temp2/2);\n",
+" i=i+1;\n",
+"end\n",
+"\n",
+"temp2=0;//clearing temporary variable 'temp2'\n",
+"\n",
+"for j=1:length(p)\n",
+"//multipliying bits of integer part with their position values and adding \n",
+" temp2=temp2+(p(j)*10^(j-1));\n",
+"end\n",
+"\n",
+"while(temp4~=0) //storing each decimal digit in vector for convenience\n",
+" temp4=temp4*2;\n",
+" d(x)=floor(temp4);\n",
+" x=x+1;\n",
+" temp4=modulo(temp4,1);\n",
+"end \n",
+"\n",
+"temp5=0;//clearing temporary variable 'temp5'\n",
+"\n",
+"for j=1:length(d)\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp5=temp5+(10^(-1*j)*d(j))\n",
+"end\n",
+"\n",
+"temp3=temp2+temp5;\n",
+"//finally adding both the integer and decimal parts to get total output.\n",
+"disp(temp3,'the equivalent binary number is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.17: decimal_to_octal_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;//clears the command window \n",
+"clear;//clears all the variables \n",
+"//example 25.17\n",
+"//decimal to octa conversion\n",
+"\n",
+"format('v',8);//making the default precision to 8 significant digits\n",
+"i=1;w=1;\n",
+"dec=375.23;//given decimal number which should be expressed in base 8\n",
+"temp=modulo(dec,1);//separating decimal part from the given number\n",
+"temp2=floor(dec);//separating integer part from the given number\n",
+"\n",
+"\n",
+"while(temp2>0)//storing each integer digit in vector for convenience\n",
+" p(i)=(modulo(floor(temp2),8))\n",
+" temp2=floor(temp2/8);\n",
+" i=i+1;\n",
+"end\n",
+"\n",
+"temp2=0;//clearing temporary variable 'temp2'\n",
+"\n",
+"for j=1:length(p)\n",
+"//multipliying bits of integer part with their position values and adding \n",
+" temp2=temp2+(p(j)*10^(j-1));\n",
+"end\n",
+"\n",
+"while(temp~=0) //storing each decimal digit in vector for convenience\n",
+" temp=temp*8;\n",
+" q(w)=floor(temp);\n",
+" w=w+1;\n",
+" temp=modulo(temp,1);\n",
+"end \n",
+"\n",
+"temp1=0; //flag bit\n",
+"for k=1:length(q)\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp1=temp1+(10^(-1*k)*q(k));\n",
+"end\n",
+"temp3=temp2+temp1;\n",
+"disp(temp3,'octal number is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.18: octal_to_binary_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.18\n",
+"//ocatl to binary conversion\n",
+"\n",
+"//given values\n",
+"X='257';//octal number\n",
+"\n",
+"//calculation\n",
+"x=oct2dec(X);//decimal equivalent\n",
+"Z=dec2bin(x);\n",
+"disp(Z,'binary number is ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.19: octal_to_binary_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;//clears the command window \n",
+"clear;//clears all the variables \n",
+"//example 25.19\n",
+"//octal to binary conversion\n",
+"\n",
+"format('v',8);//setting the default precision to 8\n",
+"\n",
+"i=1;w=1;\n",
+"\n",
+"bin=34.56; //Given octal number which we need to be convert into binary\n",
+"temp1=floor(bin);//separating integer part from the given number\n",
+"temp0=modulo(bin,1);//separating decimal part from the given number\n",
+"temp2=temp0*10^2;//converting decimal value to interger for convenience\n",
+"while(temp1>0) //storing each integer digit in vector for convenience\n",
+" p(i)=modulo(temp1,10);\n",
+" temp1=round(temp1/10);\n",
+" i=i+1;\n",
+"end\n",
+"\n",
+"while(temp2>0) //storing each decimal digit in vector for convenience\n",
+" q(w)=modulo(temp2,10);\n",
+" temp2=floor(temp2/10);\n",
+" w=w+1;\n",
+" \n",
+"end\n",
+"temp1=0; //clearing temporary variable 'temp1\n",
+"\n",
+"for i=1:2\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp1=temp1+(p(i)*8^(i-1));\n",
+"end\n",
+"\n",
+"temp2=0;//clearing temporary variable 'temp2'\n",
+"for z=1:2\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp2=temp2+(q(z)*8^(-1*(3-z)));\n",
+" \n",
+"end\n",
+"\n",
+"temp=temp1+temp2;\n",
+"//adding both integer and decimal parts to get total deciaml value.\n",
+"dec=temp;\n",
+"\n",
+"temp2=floor(dec); //separating integer part from the given number\n",
+"temp3=modulo(dec,1);//separating decimal part from the given number\n",
+"format('v',18);//setting the default precision to 8\n",
+"\n",
+"i=1;x=1;//flag bits\n",
+"\n",
+"while(temp2>0)//storing each integer digit in vector for convenience\n",
+" p(i)=(modulo(floor(temp2),2))\n",
+" temp2=floor(temp2/2);\n",
+" i=i+1;\n",
+"end\n",
+"\n",
+"temp2=0; //clears temporary variable 'temp2'\n",
+"\n",
+"for j=1:length(p)\n",
+"//multipliying bits of integer part with their position values and adding \n",
+" temp2=temp2+(p(j)*10^(j-1));\n",
+"end\n",
+"\n",
+"temp4=modulo(temp3,1);\n",
+"\n",
+"while(temp4~=0)//storing each decimal digit in vector for convenience\n",
+" temp4=temp4*2;\n",
+" d(x)=floor(temp4);\n",
+" x=x+1;\n",
+" temp4=modulo(temp4,1);\n",
+"end \n",
+"\n",
+"temp5=0; //clears temporary variable 'temp2'\n",
+"\n",
+"for j=1:length(d)\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp5=temp5+(10^(-1*j)*d(j))\n",
+"end\n",
+"\n",
+"temp=temp2+temp5;\n",
+"//finally adding both the integer and decimal parts to get total output.\n",
+"disp(temp,'binary number is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.1: sum_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.1\n",
+"//calculation of sum of two binary numbers\n",
+"\n",
+"//given values\n",
+"X='0011';//first binary number\n",
+"Y='0101';//second binary number\n",
+"\n",
+"//calculation\n",
+"x=bin2dec(X);//decimal equivalent\n",
+"y=bin2dec(Y);//decimal equivalent\n",
+"z=x+y;\n",
+"Z=dec2bin(z);\n",
+"disp(Z,'Sum of the given binary numbers is ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.20: binary_to_octal_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;//clears the command window \n",
+"clear;//clears all the variables \n",
+"i=1;w=1;\n",
+"bin=1011.01101;//Given binary number which we need to be convert into octal\n",
+"\n",
+"//conversion to decimal first\n",
+"temp1=floor(bin);//separating integer part from the given number\n",
+"temp2=modulo(bin,1);//separating decimal part from the given number\n",
+"temp2=temp2*10^5;//converting decimal value to integer for convenience\n",
+"while(temp1>0)//storing each integer digit in vector for convenience\n",
+" p(i)=modulo(temp1,10);\n",
+" temp1=floor(temp1/10);\n",
+" i=i+1;\n",
+"end\n",
+"while(temp2>0)//storing each decimal digit in vector for convenience\n",
+" q(w)=modulo(temp2,2);\n",
+" temp2=(temp2/10);\n",
+" temp2=floor(temp2);\n",
+" w=w+1;\n",
+"end\n",
+"temp1=0;//flag bit\n",
+"for i=1:length(p)//checking whether it is a binary number or not\n",
+" if(p(i)>1) then\n",
+" disp('not a binary number');\n",
+" abort; \n",
+" end\n",
+"end\n",
+"for i=1:length(p)\n",
+"//multipliying bits of integer part with their position values and adding \n",
+" temp1=temp1+(p(i)*2^(i-1));\n",
+"end\n",
+"temp2=0;//flag bit\n",
+"for z=1:length(q)\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp2=temp2+(q(z)*2^(-1*(6-z)));\n",
+"end\n",
+"dec=temp1+temp2;\n",
+"//finally adding both the integer and decimal parts to get decimal equivalent\n",
+"\n",
+"//conversion from decimal to octal\n",
+"\n",
+"format('v',8);//making the default precision to 8 significant digits\n",
+"i=1;w=1;\n",
+"\n",
+"temp=modulo(dec,1);//separating decimal part from the given number\n",
+"temp2=floor(dec);//separating integer part from the given number\n",
+"\n",
+"\n",
+"while(temp2>0)//storing each integer digit in vector for convenience\n",
+" r(i)=(modulo(floor(temp2),8))\n",
+" temp2=floor(temp2/8);\n",
+" i=i+1;\n",
+"end\n",
+"\n",
+"temp2=0;//clearing temporary variable 'temp2'\n",
+"\n",
+"for j=1:length(r)\n",
+"//multipliying bits of integer part with their position values and adding \n",
+" temp2=temp2+(r(j)*10^(j-1));\n",
+"end\n",
+"\n",
+"while(temp~=0) //storing each decimal digit in vector for convenience\n",
+" temp=temp*8;\n",
+" s(w)=floor(temp);\n",
+" w=w+1;\n",
+" temp=modulo(temp,1);\n",
+"end \n",
+"\n",
+"temp1=0; //flag bit\n",
+"for k=1:length(s)\n",
+"//multipliying bits of decimal part with their position values and adding \n",
+" temp1=temp1+(10^(-1*k)*s(k));\n",
+"end\n",
+"temp3=temp2+temp1;\n",
+"disp(temp3,'octal number is');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.21: hexa_to_decimal_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.21\n",
+"//hexadecimal to decimal conversion\n",
+"\n",
+"//given values\n",
+"X='AC5';//hexadecimal number\n",
+"\n",
+"//calculation\n",
+"x=hex2dec(X);//decimal equivalent\n",
+"disp(x,'decimal number is ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.22: decimal_to_hexadecimal_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;//clears the command window \n",
+"clear;//clears all the variables \n",
+"//example 25.22\n",
+"//decimal to hexadecimal conversion\n",
+"format('v',4);//making the default precision to 8 significant digits\n",
+"dec=379.54;//given decimal\n",
+"w=1;i=1;\n",
+"\n",
+"temp1=floor(dec);//separating integer part from the given number\n",
+"temp2=modulo(dec,1);//separating decimal part from the given number\n",
+"x=dec2hex(temp1);//hexadecimal equivalent of integer part\n",
+"s=0;\n",
+"\n",
+"while(temp2~=0) //storing each decimal digit in vector for convenience\n",
+" temp2=temp2*16;\n",
+" q(w)=floor(temp2);\n",
+" s=s+1;//counter of a\n",
+" a(w)=dec2hex(q(w));\n",
+" w=w+1;\n",
+" temp2=modulo(temp2,1);\n",
+"end\n",
+"f=a(1);\n",
+"for i=2:s\n",
+" f=f+a(i);\n",
+"end\n",
+"b='.';//for concatenating to get the decimal part of hexadecimal \n",
+"hex=x+b+f;//concatenating integer and decimal part\n",
+"disp(hex,'hexadecimal equivalent is');\n",
+""
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.23: hexa_to_binary_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.23\n",
+"//hexadecimal to binary conversion\n",
+"\n",
+"//given values\n",
+"X='7AB';//hexadecimal number\n",
+"\n",
+"//calculation\n",
+"x=hex2dec(X);//decimal equivalent\n",
+"z=dec2bin(x);\n",
+"disp(z,'binary number is ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.24: binary_to_hexa_conversion.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.24\n",
+"//binary to hexadecimal conversion\n",
+"\n",
+"//given values\n",
+"X='1011101';//binary number\n",
+"\n",
+"//calculation\n",
+"x=bin2dec(X);//decimal equivalent\n",
+"z=dec2hex(x);\n",
+"disp(z,'hexadecimal number is ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.25: Substraction_by_ones_complement_method.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clc;\n",
+"clear;\n",
+"//Example 25.25\n",
+"//substraction by one's complement method\n",
+"//aaa=input(' Enter the first no (in decimal) :');\n",
+"//bb=input(' Enter the number from which first no has to be substracted:');\n",
+"bb=14;\n",
+"aaa=-7;// substraction is addition of negative number\n",
+"if aaa<0 then\n",
+" aa=-1*aaa;\n",
+"else aa=aaa;\n",
+"end\n",
+"a=0;\n",
+"b=0;\n",
+"q=0;\n",
+"for i=1:5 //converting from decimal to binary \n",
+" x=modulo(aa,2);\n",
+" a= a + (10^q)*x;\n",
+" aa=aa/2;\n",
+" aa=floor(aa);\n",
+" q=q+1; \n",
+"end\n",
+"q=0;\n",
+"for i=1:5 //converting from decimal to binary \n",
+" y=modulo(bb,2);\n",
+" b= b + (10^q)*y;\n",
+" bb=bb/2;\n",
+" bb=floor(bb);\n",
+" q=q+1; \n",
+"end\n",
+"for i=1:5\n",
+" a1(i)=modulo(a,10);\n",
+" a=a/10;\n",
+" a=round(a);\n",
+" \n",
+"end\n",
+"for i=1:5\n",
+" b1(i)=modulo(b,10);\n",
+" b=b/10;\n",
+" b=round(b);\n",
+"end;\n",
+"if aaa<0 then// making one's complement if number is less than zero\n",
+" for i=1:5\n",
+" a1(i)=bitcmp(a1(i),1);\n",
+" end\n",
+" \n",
+" car(1)=0;\n",
+" \n",
+"for i=1:5\n",
+" c1(i)=a1(i)+b1(i)+car(i);\n",
+" if c1(i)== 2 then\n",
+" car(i+1)= 1;\n",
+" c1(i)=0;\n",
+" elseif c1(i)==3 then \n",
+" car(i+1)= 1;\n",
+" c1(i)=1;\n",
+" else \n",
+" car(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"car2(1)=car(6);\n",
+"re=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re=re+(c1(i)*(10^(i-1))) //result of one's complement addition \n",
+" end;\n",
+"\n",
+"\n",
+" \n",
+"for i=1:5\n",
+" s(i)=modulo(re,10);\n",
+" re=re/10;\n",
+" re=round(re);\n",
+"end;\n",
+" \n",
+"for i=1:5\n",
+" re1(i)=s(i)+car2(i);//addition of carry after one's complement addition\n",
+" if re1(i)== 2 then\n",
+" car2(i+1)= 1;\n",
+" re1(i)=0;\n",
+" elseif re1(i)==3 then \n",
+" car2(i+1)= 1;\n",
+" re1(i)=1;\n",
+" else \n",
+" car2(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+" re2=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1))) \n",
+" end; \n",
+"\n",
+" disp(re,'difference is') \n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.26: Substraction_by_ones_complement_method.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clc;\n",
+"clear;\n",
+"//example 25.26\n",
+"//substraction by one's complement method\n",
+"//a=input(' Enter the first no (binary) :');\n",
+"//b=input(' Enter the number from which first no has to be substracted:');\n",
+"a=10001;\n",
+"b=10011;\n",
+"q=0;\n",
+"\n",
+"for i=1:5\n",
+" a1(i)=modulo(a,10);\n",
+" a=a/10;\n",
+" a=round(a);\n",
+" \n",
+"end\n",
+"for i=1:5\n",
+" b1(i)=modulo(b,10);\n",
+" b=b/10;\n",
+" b=round(b);\n",
+"end;\n",
+" for i=1:5//making one's complement of number to be substracted\n",
+" a1(i)=bitcmp(a1(i),1);\n",
+"end\n",
+" \n",
+"car(1)=0;\n",
+" \n",
+"for i=1:5\n",
+" c1(i)=a1(i)+b1(i)+car(i);\n",
+" if c1(i)== 2 then\n",
+" car(i+1)= 1;\n",
+" c1(i)=0;\n",
+" elseif c1(i)==3 then \n",
+" car(i+1)= 1;\n",
+" c1(i)=1;\n",
+" else \n",
+" car(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"car2(1)=car(6);\n",
+"re=0;\n",
+"format('v',18);\n",
+"for i=1:5\n",
+" re=re+(c1(i)*(10^(i-1))) //result of one's complement addition \n",
+"end;\n",
+"\n",
+" \n",
+"for i=1:5\n",
+" s(i)=modulo(re,10);\n",
+" re=re/10;\n",
+" re=round(re);\n",
+"end;\n",
+"if car2(1)==1 then// checking carry\n",
+" \n",
+"for i=1:5\n",
+" re1(i)=s(i)+car2(i);//addition of carry after one's complement addition\n",
+" if re1(i)== 2 then\n",
+" car2(i+1)= 1;\n",
+" re1(i)=0;\n",
+" elseif re1(i)==3 then \n",
+" car2(i+1)= 1;\n",
+" re1(i)=1;\n",
+" else \n",
+" car2(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+" re2=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1))) \n",
+" end; \n",
+"disp(re2,'difference is') ;\n",
+"\n",
+"else\n",
+" for i=1:5\n",
+" re1(i)=bitcmp(s(i),1);\n",
+" end\n",
+" re2=0;\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1)))\n",
+" end;\n",
+" re2=-1*re2;\n",
+" disp(re2,'difference is') ;\n",
+" end;\n",
+" \n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.27: Substraction_by_ones_complement_method.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clc;\n",
+"clear;\n",
+"//example 25.27\n",
+"//substraction by one's complement method\n",
+"//a=input(' Enter the first no (binary) :');\n",
+"//b=input(' Enter the number from which first no has to be substracted:');\n",
+"a=10011;\n",
+"b=10001;\n",
+"q=0;\n",
+"\n",
+"for i=1:5\n",
+" a1(i)=modulo(a,10);\n",
+" a=a/10;\n",
+" a=round(a);\n",
+"end\n",
+"for i=1:5\n",
+" b1(i)=modulo(b,10);\n",
+" b=b/10;\n",
+" b=round(b);\n",
+"end;\n",
+"for i=1:5//making one's complement of number to be substracted\n",
+" a1(i)=bitcmp(a1(i),1);\n",
+"end\n",
+" \n",
+"car(1)=0;\n",
+" \n",
+"for i=1:5\n",
+" c1(i)=a1(i)+b1(i)+car(i);\n",
+" if c1(i)== 2 then\n",
+" car(i+1)= 1;\n",
+" c1(i)=0;\n",
+" elseif c1(i)==3 then \n",
+" car(i+1)= 1;\n",
+" c1(i)=1;\n",
+" else \n",
+" car(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"car2(1)=car(6);\n",
+"re=0;\n",
+"format('v',18);\n",
+"for i=1:5\n",
+" re=re+(c1(i)*(10^(i-1))) //result of one's complement addition \n",
+"end;\n",
+"\n",
+"for i=1:5\n",
+" s(i)=modulo(re,10);\n",
+" re=re/10;\n",
+" re=round(re);\n",
+"end;\n",
+"if car2(1)==1 then// checking carry \n",
+" \n",
+"for i=1:5\n",
+" re1(i)=s(i)+car2(i);//addition of carry after one's complement addition\n",
+" if re1(i)== 2 then\n",
+" car2(i+1)= 1;\n",
+" re1(i)=0;\n",
+" elseif re1(i)==3 then \n",
+" car2(i+1)= 1;\n",
+" re1(i)=1;\n",
+" else \n",
+" car2(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+" re2=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1))) \n",
+" end; \n",
+" re2= -1*re2;\n",
+"disp(re2,'difference is') ;\n",
+"\n",
+"else\n",
+" for i=1:5\n",
+" re1(i)=bitcmp(s(i),1);\n",
+" end\n",
+" re2=0;\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1)))\n",
+" end;\n",
+" re2=-1*re2;\n",
+" disp(re2,'difference is') ;\n",
+"\n",
+"end;\n",
+" \n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.28: finding_twos_complement.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"//example25.28\n",
+"//finiding two's complement\n",
+"//a=input(' Enter the number (binary) :');\n",
+"a=1010;\n",
+"for i=1:4\n",
+" a1(i)=modulo(a,10);\n",
+" a=a/10;\n",
+" a=round(a);\n",
+" \n",
+"end\n",
+"for i=1:4//making one's complement of number\n",
+" a1(i)=bitcmp(a1(i),1);\n",
+"end\n",
+"for i=1:4\n",
+"car(1)=1;\n",
+"re(i)=a1(i)+car(i);//addition of one to one's complement to contain two's complement\n",
+" if re(i)== 2 then\n",
+" car(i+1)= 1;\n",
+" re(i)=0;\n",
+" elseif re(i)==3 then \n",
+" car(i+1)= 1;\n",
+" re(i)=1;\n",
+" else \n",
+" car(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+" re2=0;\n",
+"format('v',18);\n",
+" for i=1:4\n",
+" re2=re2+(re(i)*(10^(i-1))) \n",
+" end; \n",
+"disp(re2,'two s complement is'); "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.29: Addition_of_negative_number_by_twos_complement_method.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clc;\n",
+"clear;\n",
+"//Example 25.29\n",
+"//addition of negative number by by two's complement method\n",
+"//bb=input(' Enter the first no (in decimal) :');\n",
+"//aaa=input(' Enter the negative number that has to be added');\n",
+"bb=14;\n",
+"aaa=-7;\n",
+"if aaa<0 then\n",
+" aa=-1*aaa;\n",
+"else aa=aaa;\n",
+"end\n",
+"a=0;\n",
+"b=0;\n",
+"q=0;\n",
+"for i=1:5 //converting from decimal to binary \n",
+" x=modulo(aa,2);\n",
+" a= a + (10^q)*x;\n",
+" aa=aa/2;\n",
+" aa=floor(aa);\n",
+" q=q+1; \n",
+"end\n",
+"q=0;\n",
+"for i=1:5 //converting from decimal to binary \n",
+" y=modulo(bb,2);\n",
+" b= b + (10^q)*y;\n",
+" bb=bb/2;\n",
+" bb=floor(bb);\n",
+" q=q+1; \n",
+"end\n",
+"for i=1:5\n",
+" a1(i)=modulo(a,10);\n",
+" a=a/10;\n",
+" a=round(a);\n",
+" \n",
+"end\n",
+"for i=1:5\n",
+" b1(i)=modulo(b,10);\n",
+" b=b/10;\n",
+" b=round(b);\n",
+"end;\n",
+"if aaa<0 then// making one's complement of the negative number\n",
+" for i=1:5\n",
+" a1(i)=bitcmp(a1(i),1);\n",
+" end\n",
+" \n",
+" car(1)=0;\n",
+" \n",
+"for i=1:5\n",
+" c1(i)=a1(i)+b1(i)+car(i);\n",
+" if c1(i)== 2 then\n",
+" car(i+1)= 1;\n",
+" c1(i)=0;\n",
+" elseif c1(i)==3 then \n",
+" car(i+1)= 1;\n",
+" c1(i)=1;\n",
+" else \n",
+" car(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"re=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re=re+(c1(i)*(10^(i-1))) //result of one's complement addition \n",
+" end;\n",
+"for i=1:5\n",
+" s(i)=modulo(re,10);\n",
+" re=re/10;\n",
+" re=round(re);\n",
+"end;\n",
+"if car(6)==1 then// checking carry\n",
+" car2(1)=1;\n",
+" \n",
+"for i=1:5\n",
+" re1(i)=s(i)+car2(i);//addition of carry after one's complement addition\n",
+" if re1(i)== 2 then\n",
+" car2(i+1)= 1;\n",
+" re1(i)=0;\n",
+" elseif re1(i)==3 then \n",
+" car2(i+1)= 1;\n",
+" re1(i)=1;\n",
+" else \n",
+" car2(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+" re2=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1))) \n",
+" end; \n",
+"\n",
+" disp(re2,'difference is') ;\n",
+" \n",
+"else \n",
+" for i=1:5\n",
+" re1(i)=bitcmp(s(i),1);\n",
+" end\n",
+" re2=0;\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1)))\n",
+" end;\n",
+" re2=-1*re2;\n",
+" disp(re2,'difference is') ;\n",
+" end;\n",
+" \n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.2: sum_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"//example 25.2\n",
+"//addition of binary numbers\n",
+"\n",
+"a=1010.00; //first number \n",
+"b=0011.11; //second number\n",
+"A=bin21dec(a); //converting a in to decimal number \n",
+"B=bin21dec(b); //converting b in to decimal number \n",
+"S=A+B; //adding the two decimal numbers\n",
+"temp=dec21bin(S); //converting the decimal sum back to binary\n",
+"format('v',10); //changing the default precision to 8\n",
+"disp(temp,'sum is'); //displaying the final output"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.30: Substraction_by_twos_complement_method.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"\n",
+"clc;\n",
+"clear;\n",
+"//example 25.27\n",
+"//substarction by one's complement method\n",
+"//a=input(' Enter the first no (binary) :');\n",
+"//b=input(' Enter the number from which first no has to be substracted:');\n",
+"a=10011;\n",
+"b=10001;\n",
+"q=0;\n",
+"\n",
+"for i=1:5\n",
+" a1(i)=modulo(a,10);\n",
+" a=a/10;\n",
+" a=round(a);\n",
+"end\n",
+"for i=1:5\n",
+" b1(i)=modulo(b,10);\n",
+" b=b/10;\n",
+" b=round(b);\n",
+"end;\n",
+"for i=1:5//making one's complement of number to be substracted\n",
+" a1(i)=bitcmp(a1(i),1);\n",
+"end\n",
+" \n",
+"car(1)=0;\n",
+" \n",
+"for i=1:5\n",
+" c1(i)=a1(i)+b1(i)+car(i);\n",
+" if c1(i)== 2 then\n",
+" car(i+1)= 1;\n",
+" c1(i)=0;\n",
+" elseif c1(i)==3 then \n",
+" car(i+1)= 1;\n",
+" c1(i)=1;\n",
+" else \n",
+" car(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+"re=0;\n",
+"format('v',18);\n",
+"for i=1:5\n",
+" re=re+(c1(i)*(10^(i-1))) //result of one's complement addition \n",
+"end;\n",
+"\n",
+"for i=1:5\n",
+" s(i)=modulo(re,10);\n",
+" re=re/10;\n",
+" re=round(re);\n",
+"end;\n",
+"if car(6)==1 then// checking carry \n",
+" \n",
+"for i=1:5\n",
+" re1(i)=s(i)+car2(i);//addition of carry after one's complement addition\n",
+" if re1(i)== 2 then\n",
+" car2(i+1)= 1;\n",
+" re1(i)=0;\n",
+" elseif re1(i)==3 then \n",
+" car2(i+1)= 1;\n",
+" re1(i)=1;\n",
+" else \n",
+" car2(i+1)=0;\n",
+" end;\n",
+"end;\n",
+"\n",
+" re2=0;\n",
+"format('v',18);\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1))) \n",
+" end; \n",
+" re2= -1*re2;\n",
+"disp(re2,'difference is') ;\n",
+"\n",
+"else\n",
+" for i=1:5\n",
+" re1(i)=bitcmp(s(i),1);\n",
+" end\n",
+" re2=0;\n",
+" for i=1:5\n",
+" re2=re2+(re1(i)*(10^(i-1)))\n",
+" end;\n",
+" re2=-1*re2;\n",
+" disp(re2,'difference is') ;\n",
+"\n",
+"end;\n",
+" \n",
+" "
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.3: sum_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"//example 25.3\n",
+"//addition of two binary numbers\n",
+"\n",
+"a=1011.01; //first number \n",
+"b=1101.11; //second number\n",
+"A=bin21dec(a); //converting a in to decimal number \n",
+"B=bin21dec(b); //converting b in to decimal number \n",
+"S=A+B; //adding the two decimal numbers\n",
+"temp=dec21bin(S); //converting the decimal sum back to binary\n",
+"format('v',10); //changing the default precision to 8\n",
+"disp(temp,'sum is'); //displaying the final output"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.4: difference_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.4\n",
+"//calculation of difference of two binary numbers\n",
+"\n",
+"//given values\n",
+"X='1011';//first binary number\n",
+"Y='0101';//second binary number \n",
+"\n",
+"//calculation\n",
+"x=bin2dec(X);//decimal equivalent\n",
+"y=bin2dec(Y);//decimal equivalent\n",
+"z=x-y;\n",
+"Z=dec2bin(z);\n",
+"disp(Z,'difference of the given binary numbers ');"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.5: difference_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.5\n",
+"//calculation of difference of two binary numbers\n",
+"\n",
+"//given values\n",
+"X='1000';//first binary number\n",
+"Y='0011';//second binary number \n",
+"\n",
+"//calculation\n",
+"x=bin2dec(X);//decimal equivalent\n",
+"y=bin2dec(Y);//decimal equivalent\n",
+"z=x-y;\n",
+"Z=dec2bin(z);\n",
+"disp(Z,'difference of the given binary numbers ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.6: difference_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"//example 25.6\n",
+"//binary substraction\n",
+"\n",
+"format('v',8);//changing the default precision to 8\n",
+"a=1001.01;//first number \n",
+"b=0011.10;//second number\n",
+"A=bin21dec(a);//converting a in to decimal number \n",
+"B=bin21dec(b);//converting b in to decimal number \n",
+"S=A-B; //multiply the two decimal numbers\n",
+"temp=dec21bin(S);//converting the decimal product back to binary\n",
+"\n",
+"disp(temp,'difference is');//displaying the final output"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.7: product_of_two_binary_numbers.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.7\n",
+"//calculation of product of two binary numbers\n",
+"\n",
+"//given values\n",
+"X='10101';//first binary number with last two digits in fractional part\n",
+"Y='101';//second binary number with last two digits in fractional part\n",
+"\n",
+"//calculation\n",
+"x=bin2dec(X);//decimal equivalent\n",
+"y=bin2dec(Y);//decimal equivalent\n",
+"z=x*y;\n",
+"Z=dec2bin(z);\n",
+"disp(Z,'product of the given binary numbers is ')"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.8: binary_multiplication.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;\n",
+"clear;\n",
+"//example 25.8\n",
+"//binary multiplication\n",
+"\n",
+"format('v',8);//changing the default precision to 8\n",
+"a=10101.01;//first number \n",
+"b=110.10;//second number\n",
+"A=bin21dec(a);//converting a in to decimal number \n",
+"B=bin21dec(b);//converting b in to decimal number \n",
+"S=A*B; //multiply the two decimal numbers\n",
+"temp=dec21bin(S);//converting the decimal product back to binary\n",
+"\n",
+"disp(temp,'product is');//displaying the final output"
+ ]
+ }
+,
+{
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 25.9: binary_division.sce"
+ ]
+ },
+ {
+"cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+"source": [
+"clc;clear;\n",
+"//Example 25.9\n",
+"//calculation of quotient of two binary numbers\n",
+"\n",
+"//given values\n",
+"X='1101001';//divident\n",
+"Y='101';//divisor\n",
+"\n",
+"//calculation\n",
+"x=bin2dec(X);//decimal equivalent\n",
+"y=bin2dec(Y);//decimal equivalent\n",
+"z=x/y;\n",
+"Z=dec2bin(z);\n",
+"disp(Z,'quotient of the given binary numbers with last two digits in fractional part is ')"
+ ]
+ }
+],
+"metadata": {
+ "kernelspec": {
+ "display_name": "Scilab",
+ "language": "scilab",
+ "name": "scilab"
+ },
+ "language_info": {
+ "file_extension": ".sce",
+ "help_links": [
+ {
+ "text": "MetaKernel Magics",
+ "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
+ }
+ ],
+ "mimetype": "text/x-octave",
+ "name": "scilab",
+ "version": "0.7.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}