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 /462/CH2 | |
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 '462/CH2')
86 files changed, 887 insertions, 0 deletions
diff --git a/462/CH2/EX2.1/ex_2_1.pdf b/462/CH2/EX2.1/ex_2_1.pdf Binary files differnew file mode 100755 index 000000000..3801f8f40 --- /dev/null +++ b/462/CH2/EX2.1/ex_2_1.pdf diff --git a/462/CH2/EX2.1/ex_2_1.sce b/462/CH2/EX2.1/ex_2_1.sce new file mode 100755 index 000000000..c6fd6de6d --- /dev/null +++ b/462/CH2/EX2.1/ex_2_1.sce @@ -0,0 +1,6 @@ +//example 2.1//
+//decimal to binary conversion//
+ans=bin2dec('11111')
+//decimal equivalent of binary number//
+disp(ans)
+//answer in decimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.10.a/ex_2_10_a.pdf b/462/CH2/EX2.10.a/ex_2_10_a.pdf Binary files differnew file mode 100755 index 000000000..119116b5b --- /dev/null +++ b/462/CH2/EX2.10.a/ex_2_10_a.pdf diff --git a/462/CH2/EX2.10.a/ex_2_10_a.sce b/462/CH2/EX2.10.a/ex_2_10_a.sce new file mode 100755 index 000000000..77b217f90 --- /dev/null +++ b/462/CH2/EX2.10.a/ex_2_10_a.sce @@ -0,0 +1,18 @@ +//example 2.10(a)//
+//find 2's complement of binary number//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=01001110
+//the number//
+xd=bin2dec('01001110')
+//binary to decimal conversion//
+xc=bitcmp(xd,8)
+//one's complement of the number//
+xp=xc+1
+xc1=dec2bin(xp)
+//2's complement of the number//
+disp('2s complement of 01001110 is : ')
+disp(xc1)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.10.b/ex_2_10_b.pdf b/462/CH2/EX2.10.b/ex_2_10_b.pdf Binary files differnew file mode 100755 index 000000000..5bc41d539 --- /dev/null +++ b/462/CH2/EX2.10.b/ex_2_10_b.pdf diff --git a/462/CH2/EX2.10.b/ex_2_10_b.sce b/462/CH2/EX2.10.b/ex_2_10_b.sce new file mode 100755 index 000000000..d0c9a8d14 --- /dev/null +++ b/462/CH2/EX2.10.b/ex_2_10_b.sce @@ -0,0 +1,18 @@ +//example 2.10(b)//
+//find 2's complement of binary number//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=00110101
+//the number//
+xd=bin2dec('00110101')
+//binary to decimal conversion//
+xc=bitcmp(xd,8)
+//one's complement of the number//
+xp=xc+1
+xc1=dec2bin(xp)
+//2's complement of the number//
+disp('2s complement of 00110101 is : ')
+disp(xc1)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.11.a/ex_2_11_a.pdf b/462/CH2/EX2.11.a/ex_2_11_a.pdf Binary files differnew file mode 100755 index 000000000..c5655a9a6 --- /dev/null +++ b/462/CH2/EX2.11.a/ex_2_11_a.pdf diff --git a/462/CH2/EX2.11.a/ex_2_11_a.sce b/462/CH2/EX2.11.a/ex_2_11_a.sce new file mode 100755 index 000000000..9fb07532f --- /dev/null +++ b/462/CH2/EX2.11.a/ex_2_11_a.sce @@ -0,0 +1,18 @@ +//example 2.11(a)//
+//find 2's complement of binary number//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=01100100
+//the number//
+xd=bin2dec('01100100')
+//binary to decimal conversion//
+xc=bitcmp(xd,8)
+//one's complement of the number//
+xp=xc+1
+xc1=dec2bin(xp)
+//2's complement of the number//
+disp('2s complement of 01100100 is : ')
+disp(xc1)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.11.b/ex_2_11_b.pdf b/462/CH2/EX2.11.b/ex_2_11_b.pdf Binary files differnew file mode 100755 index 000000000..74345dfb8 --- /dev/null +++ b/462/CH2/EX2.11.b/ex_2_11_b.pdf diff --git a/462/CH2/EX2.11.b/ex_2_11_b.sce b/462/CH2/EX2.11.b/ex_2_11_b.sce new file mode 100755 index 000000000..6f126683d --- /dev/null +++ b/462/CH2/EX2.11.b/ex_2_11_b.sce @@ -0,0 +1,18 @@ +//example 2.11(b)//
+//find 2's complement of binary number//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=10010010
+//the number//
+xd=bin2dec('10010010')
+//binary to decimal conversion//
+xc=bitcmp(xd,8)
+//one's complement of the number//
+xp=xc+1
+xc1=dec2bin(xp)
+//2's complement of the number//
+disp('2s complement of 10010010 is : ')
+disp(xc1)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.11.c/ex_2_11_c.pdf b/462/CH2/EX2.11.c/ex_2_11_c.pdf Binary files differnew file mode 100755 index 000000000..949e28910 --- /dev/null +++ b/462/CH2/EX2.11.c/ex_2_11_c.pdf diff --git a/462/CH2/EX2.11.c/ex_2_11_c.sce b/462/CH2/EX2.11.c/ex_2_11_c.sce new file mode 100755 index 000000000..9ec53a9fb --- /dev/null +++ b/462/CH2/EX2.11.c/ex_2_11_c.sce @@ -0,0 +1,18 @@ +//example 2.11(c)//
+//find 2's complement of binary number//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=11011000
+//the number//
+xd=bin2dec('11011000')
+//binary to decimal conversion//
+xc=bitcmp(xd,8)
+//one's complement of the number//
+xp=xc+1
+xc1=dec2bin(xp)
+//2's complement of the number//
+disp('2s complement of 11011000 is : ')
+disp(xc1)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.11.d/ex_2_11_d.pdf b/462/CH2/EX2.11.d/ex_2_11_d.pdf Binary files differnew file mode 100755 index 000000000..d6562be2a --- /dev/null +++ b/462/CH2/EX2.11.d/ex_2_11_d.pdf diff --git a/462/CH2/EX2.11.d/ex_2_11_d.sce b/462/CH2/EX2.11.d/ex_2_11_d.sce new file mode 100755 index 000000000..1a9e248fe --- /dev/null +++ b/462/CH2/EX2.11.d/ex_2_11_d.sce @@ -0,0 +1,18 @@ +//example 2.11(d)//
+//find 2's complement of binary number//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=01100111
+//the number//
+xd=bin2dec('01100111')
+//binary to decimal conversion//
+xc=bitcmp(xd,8)
+//one's complement of the number//
+xp=xc+1
+xc1=dec2bin(xp)
+//2's complement of the number//
+disp('2s complement of 01100111 is : ')
+disp(xc1)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.13.a/ex_2_13_a.pdf b/462/CH2/EX2.13.a/ex_2_13_a.pdf Binary files differnew file mode 100755 index 000000000..1fb7faed3 --- /dev/null +++ b/462/CH2/EX2.13.a/ex_2_13_a.pdf diff --git a/462/CH2/EX2.13.a/ex_2_13_a.sce b/462/CH2/EX2.13.a/ex_2_13_a.sce new file mode 100755 index 000000000..6b63717bc --- /dev/null +++ b/462/CH2/EX2.13.a/ex_2_13_a.sce @@ -0,0 +1,16 @@ +//example 2.13(a)//
+//addition of binary number//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=bin2dec('1011')
+//binary to decimal conversion//
+y=bin2dec('1100')
+z=x+y
+//addition//
+a=dec2bin(z)
+//decimal to binary conversion//
+disp('the addition of given numbers is:')
+disp(a)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.13.b/ex_2_13_b.pdf b/462/CH2/EX2.13.b/ex_2_13_b.pdf Binary files differnew file mode 100755 index 000000000..be92d1120 --- /dev/null +++ b/462/CH2/EX2.13.b/ex_2_13_b.pdf diff --git a/462/CH2/EX2.13.b/ex_2_13_b.sce b/462/CH2/EX2.13.b/ex_2_13_b.sce new file mode 100755 index 000000000..75b37d416 --- /dev/null +++ b/462/CH2/EX2.13.b/ex_2_13_b.sce @@ -0,0 +1,16 @@ +//example 2.13(b)//
+//addition of binary number//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=bin2dec('0101')
+//binary to decimal conversion//
+y=bin2dec('1111')
+z=x+y
+//addition//
+a=dec2bin(z)
+//decimal to binary conversion//
+disp('the addition of given numbers is:')
+disp(a)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.14/ex_2_14.pdf b/462/CH2/EX2.14/ex_2_14.pdf Binary files differnew file mode 100755 index 000000000..415b31d25 --- /dev/null +++ b/462/CH2/EX2.14/ex_2_14.pdf diff --git a/462/CH2/EX2.14/ex_2_14.sce b/462/CH2/EX2.14/ex_2_14.sce new file mode 100755 index 000000000..8fb787ee3 --- /dev/null +++ b/462/CH2/EX2.14/ex_2_14.sce @@ -0,0 +1,22 @@ +//example 2.14//
+//addition of binary numbers//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=bin2dec('01101010')
+//x is the first number in addition//
+//binary to decimal conversion//
+y=bin2dec('00001000')
+//y is the second number in addition//
+t=bin2dec('10000001')
+//t is the third number in addition//
+k=bin2dec('11111111')
+//k is the fourth number we have to end//
+z=x+y+t+k
+//addition//
+a=dec2bin(z)
+//decimal to binary conversion//
+disp('the addition of given numbers is:')
+disp(a)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.15/ex_2_15.pdf b/462/CH2/EX2.15/ex_2_15.pdf Binary files differnew file mode 100755 index 000000000..633b11018 --- /dev/null +++ b/462/CH2/EX2.15/ex_2_15.pdf diff --git a/462/CH2/EX2.15/ex_2_15.sce b/462/CH2/EX2.15/ex_2_15.sce new file mode 100755 index 000000000..833808f03 --- /dev/null +++ b/462/CH2/EX2.15/ex_2_15.sce @@ -0,0 +1,18 @@ +//example 2.15//
+//subtraction of two binary number//
+clc
+//clears the screen//
+clear
+//clears the existing variables//
+x=bin2dec('1011')
+//x is the minuend//
+//binary to decimal conversion//
+y=bin2dec('0110')
+//y is the subtrahend//
+z=x-y
+//subtraction//
+disp('the subtraction of given numbers is:')
+ans=dec2bin(z)
+//decimal to binary conversion//
+disp(ans)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.16/ex_2_16.pdf b/462/CH2/EX2.16/ex_2_16.pdf Binary files differnew file mode 100755 index 000000000..e61419a08 --- /dev/null +++ b/462/CH2/EX2.16/ex_2_16.pdf diff --git a/462/CH2/EX2.16/ex_2_16.sce b/462/CH2/EX2.16/ex_2_16.sce new file mode 100755 index 000000000..8fc5084af --- /dev/null +++ b/462/CH2/EX2.16/ex_2_16.sce @@ -0,0 +1,18 @@ +//example 2.16//
+//multiplication in binary form//
+clc
+//clears the screen//
+clear
+//clears all the existing variables//
+x=bin2dec('1001')
+//first number to be multiplied is x//
+//binary to decimal conversion//
+y=bin2dec('1101')
+//second number to be multiplied is y//
+z=x*y
+//multiplication//
+a=dec2bin(z)
+//decimal to binary conversion//
+disp('the multiplication of given numbers results in :')
+disp(a)
+//answer in binary number//
\ No newline at end of file diff --git a/462/CH2/EX2.17/ex_2_17.pdf b/462/CH2/EX2.17/ex_2_17.pdf Binary files differnew file mode 100755 index 000000000..0093b408b --- /dev/null +++ b/462/CH2/EX2.17/ex_2_17.pdf diff --git a/462/CH2/EX2.17/ex_2_17.sce b/462/CH2/EX2.17/ex_2_17.sce new file mode 100755 index 000000000..214080af1 --- /dev/null +++ b/462/CH2/EX2.17/ex_2_17.sce @@ -0,0 +1,18 @@ +//example 2.17//
+//division in binary//
+clc
+//clears the window//
+clear
+//clears already existing variables//
+x=bin2dec('1110101')
+//x is the first number//
+//binary to decimal conversion//
+y=bin2dec('1001')
+//y is the second number w/c is to be divided//
+z=x/y
+//division//
+a=dec2bin(z)
+//decimal to binary conversion//
+disp('the division of given numbers results in:')
+disp(a)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.2.a/ex2_2_a.sce b/462/CH2/EX2.2.a/ex2_2_a.sce new file mode 100755 index 000000000..b5ba6148e --- /dev/null +++ b/462/CH2/EX2.2.a/ex2_2_a.sce @@ -0,0 +1,6 @@ +//example 2.2(a)//
+//decimal to binary conversion//
+ans=bin2dec('110101')
+//decimal equivalent of binary number//
+disp(ans)
+//answer in decimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.2.a/ex_2_2_a.pdf b/462/CH2/EX2.2.a/ex_2_2_a.pdf Binary files differnew file mode 100755 index 000000000..a6c017df6 --- /dev/null +++ b/462/CH2/EX2.2.a/ex_2_2_a.pdf diff --git a/462/CH2/EX2.2.b/ex_2_2_b.pdf b/462/CH2/EX2.2.b/ex_2_2_b.pdf Binary files differnew file mode 100755 index 000000000..74a61898b --- /dev/null +++ b/462/CH2/EX2.2.b/ex_2_2_b.pdf diff --git a/462/CH2/EX2.2.b/ex_2_2_b.sce b/462/CH2/EX2.2.b/ex_2_2_b.sce new file mode 100755 index 000000000..6e4e26dce --- /dev/null +++ b/462/CH2/EX2.2.b/ex_2_2_b.sce @@ -0,0 +1,6 @@ +//example 2.2(b)//
+//decimal to binary conversion//
+ans=bin2dec('101101')
+//decimal equivalent of binary number//
+disp(ans)
+//answer in decimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.2.c/ex_2_2_c.pdf b/462/CH2/EX2.2.c/ex_2_2_c.pdf Binary files differnew file mode 100755 index 000000000..ea68508c6 --- /dev/null +++ b/462/CH2/EX2.2.c/ex_2_2_c.pdf diff --git a/462/CH2/EX2.2.c/ex_2_2_c.sce b/462/CH2/EX2.2.c/ex_2_2_c.sce new file mode 100755 index 000000000..50e8c8d4f --- /dev/null +++ b/462/CH2/EX2.2.c/ex_2_2_c.sce @@ -0,0 +1,6 @@ +//example 2.2(c)//
+//decimal to binary conversion//
+ans=bin2dec('11111111')
+//decimal equivalent of binary number//
+disp(ans)
+//answer in decimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.2.d/ex_2_2_d.pdf b/462/CH2/EX2.2.d/ex_2_2_d.pdf Binary files differnew file mode 100755 index 000000000..824ff1ea5 --- /dev/null +++ b/462/CH2/EX2.2.d/ex_2_2_d.pdf diff --git a/462/CH2/EX2.2.d/ex_2_2_d.sce b/462/CH2/EX2.2.d/ex_2_2_d.sce new file mode 100755 index 000000000..9ba0ba837 --- /dev/null +++ b/462/CH2/EX2.2.d/ex_2_2_d.sce @@ -0,0 +1,6 @@ +//example 2.2(d)//
+//decimal to binary conversion//
+ans=bin2dec('00000000')
+//decimal equivalent of binary number//
+disp(ans)
+//answer in decimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.21/ex_2_21.pdf b/462/CH2/EX2.21/ex_2_21.pdf Binary files differnew file mode 100755 index 000000000..d4f9a0ded --- /dev/null +++ b/462/CH2/EX2.21/ex_2_21.pdf diff --git a/462/CH2/EX2.21/ex_2_21.sce b/462/CH2/EX2.21/ex_2_21.sce new file mode 100755 index 000000000..8d639aa8d --- /dev/null +++ b/462/CH2/EX2.21/ex_2_21.sce @@ -0,0 +1,11 @@ +//example 2.21//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=247
+//decimal to octal conversion//
+a=dec2oct(x)
+disp('the octal conversion of given no is:')
+disp(a)
+//answer in octal form//
\ No newline at end of file diff --git a/462/CH2/EX2.22/ex_2_22.pdf b/462/CH2/EX2.22/ex_2_22.pdf Binary files differnew file mode 100755 index 000000000..e4c9c6330 --- /dev/null +++ b/462/CH2/EX2.22/ex_2_22.pdf diff --git a/462/CH2/EX2.22/ex_2_22.sce b/462/CH2/EX2.22/ex_2_22.sce new file mode 100755 index 000000000..6249ae9bf --- /dev/null +++ b/462/CH2/EX2.22/ex_2_22.sce @@ -0,0 +1,13 @@ +//example 2.22//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+//octal to binary conversion//
+y=oct2dec('736')
+//octal to decimal conversion//
+a=dec2bin(y)
+//decimal to binary conversion//
+disp('binary conversion of given no is:')
+disp(a)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.23/ex_2_23.pdf b/462/CH2/EX2.23/ex_2_23.pdf Binary files differnew file mode 100755 index 000000000..64e9dae24 --- /dev/null +++ b/462/CH2/EX2.23/ex_2_23.pdf diff --git a/462/CH2/EX2.23/ex_2_23.sce b/462/CH2/EX2.23/ex_2_23.sce new file mode 100755 index 000000000..03f664470 --- /dev/null +++ b/462/CH2/EX2.23/ex_2_23.sce @@ -0,0 +1,13 @@ +//example 2.23//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+//binary to octal conversion//
+y=bin2dec('1001110')
+//binary to decimal conversion//
+a=dec2oct(y)
+//decimal to octal conversion//
+disp('octal representation of given no is :')
+disp(a)
+//answer in octal form//
\ No newline at end of file diff --git a/462/CH2/EX2.26/ex_2_26.pdf b/462/CH2/EX2.26/ex_2_26.pdf Binary files differnew file mode 100755 index 000000000..28136db27 --- /dev/null +++ b/462/CH2/EX2.26/ex_2_26.pdf diff --git a/462/CH2/EX2.26/ex_2_26.sce b/462/CH2/EX2.26/ex_2_26.sce new file mode 100755 index 000000000..0cdb405bc --- /dev/null +++ b/462/CH2/EX2.26/ex_2_26.sce @@ -0,0 +1,21 @@ +//example 2.26//
+//addition of octal numbers//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=oct2dec('23')
+//octal to decimal conversion//
+y=oct2dec('67')
+z=x+y
+//addition//
+a=dec2oct(z)
+//decimal to octal conversion//
+b=dec2bin(z)
+//decimal to binary conversion//
+disp('addition of given no is octal form is')
+disp(a)
+//answer in octal form//
+disp('addition of given numbers in binary form is:')
+disp(b)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.27.a/ex_2_27_a.pdf b/462/CH2/EX2.27.a/ex_2_27_a.pdf Binary files differnew file mode 100755 index 000000000..83bc5e348 --- /dev/null +++ b/462/CH2/EX2.27.a/ex_2_27_a.pdf diff --git a/462/CH2/EX2.27.a/ex_2_27_a.sce b/462/CH2/EX2.27.a/ex_2_27_a.sce new file mode 100755 index 000000000..a4e481608 --- /dev/null +++ b/462/CH2/EX2.27.a/ex_2_27_a.sce @@ -0,0 +1,21 @@ +//example 2.27 (a)//
+//subtraction of octal numbers//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=oct2dec('53')
+//octal to decimal conversion//
+y=oct2dec('37')
+z=x-y
+//subtraction//
+a=dec2oct(z)
+//decimal to octal conversion//
+b=dec2bin(z)
+//decimal to binary conversion//
+disp('result of subtraction of given numbers in octal form is:')
+disp(a)
+//answer in octal form//
+disp('result of subtraction of given numbers in binary form is:')
+disp(b)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.27.b/ex_2_27_b.pdf b/462/CH2/EX2.27.b/ex_2_27_b.pdf Binary files differnew file mode 100755 index 000000000..002a303ca --- /dev/null +++ b/462/CH2/EX2.27.b/ex_2_27_b.pdf diff --git a/462/CH2/EX2.27.b/ex_2_27_b.sce b/462/CH2/EX2.27.b/ex_2_27_b.sce new file mode 100755 index 000000000..878911665 --- /dev/null +++ b/462/CH2/EX2.27.b/ex_2_27_b.sce @@ -0,0 +1,20 @@ +//example 2.27 (b)//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=oct2dec('26')
+//octal to decimal conversion//
+y=oct2dec('75')
+z=x-y
+//subtraction//
+t=z*(-1)
+t1=bitcmp(t,8)
+//1's complement//
+t2=t1+1
+//2's compliment//
+a=dec2bin(t2)
+//decimal to binary conversion//
+disp('answer in 2''s compliment form:')
+disp(a)
+//answer in 2's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.3.a/ex2_3_a.sce b/462/CH2/EX2.3.a/ex2_3_a.sce new file mode 100755 index 000000000..19bad0638 --- /dev/null +++ b/462/CH2/EX2.3.a/ex2_3_a.sce @@ -0,0 +1,53 @@ +//example 2.3(a)//
+clc
+//clears the command window//
+clear
+//clears//
+p =1;
+//initialising//
+q =1;
+z =0;
+b =0;
+w =0;
+f =0;
+//bin= input ( ” Enter the binary no to be converted to its decimal equivalent : ”)
+//accepting the binary input from user//
+bin =101101.10101;
+d = modulo(bin,1) ;
+//separating the decimal part and the integer part//
+d= d *10^10;
+a = floor(bin) ;
+//removing the decimal part//
+while (a >0)
+// Loop to take the binary bits of integer into a matrix//
+r = modulo (a ,10) ;
+b(1,q) = r ;
+a=a/10;
+a=floor( a ) ;
+q = q +1;
+end
+for m =1: q -1
+// multipliying the bits of integer with their position values and adding//
+c=m -1;
+f=f+b(1,m)*(2^c);
+end
+while (d >0)
+ // Loop to take the binary bits of decimal into a matrix//
+ e = modulo (d ,2)
+ w (1 , p ) = e
+ d = d /10;
+ d = floor ( d )
+ p = p +1;
+ end
+for n =1: p -1
+//multipliying the bits of decimal with their position values and adding//
+z = z + w (1 , n ) *(0.5) ^(11 - n ) ;
+end
+z = z *10000;
+//rounding of to 4 decimal values//
+z = round ( z ) ;
+z = z /10000;
+x=f+z;
+disp('The Decimal equivalent of the Binary number given is');
+disp(x);
+//Displaying the final result//
\ No newline at end of file diff --git a/462/CH2/EX2.3.a/ex_2_3_a.pdf b/462/CH2/EX2.3.a/ex_2_3_a.pdf Binary files differnew file mode 100755 index 000000000..cf5ef1a3c --- /dev/null +++ b/462/CH2/EX2.3.a/ex_2_3_a.pdf diff --git a/462/CH2/EX2.3.b/ex2_3_b.sce b/462/CH2/EX2.3.b/ex2_3_b.sce new file mode 100755 index 000000000..3700404b0 --- /dev/null +++ b/462/CH2/EX2.3.b/ex2_3_b.sce @@ -0,0 +1,53 @@ +//example 2.3 (b)//
+clc
+//clears the command window//
+clear
+//clears//
+p =1;
+//initialising//
+q =1;
+z =0;
+b =0;
+w =0;
+f =0;
+//bin= input ( ” Enter the binary no to be converted to its decimal equivalent : ”)
+//accepting the binary input from user//
+bin =1100.1011;
+d = modulo(bin,1) ;
+//separating the decimal part and the integer part//
+d= d *10^10;
+a = floor(bin) ;
+//removing the decimal part//
+while (a >0)
+// Loop to take the binary bits of integer into a matrix//
+r = modulo (a ,10) ;
+b(1,q) = r ;
+a=a/10;
+a=floor( a ) ;
+q = q +1;
+end
+for m =1: q -1
+// multipliying the bits of integer with their position values and adding//
+c=m -1;
+f=f+b(1,m)*(2^c);
+end
+while (d >0)
+ // Loop to take the binary bits of decimal into a matrix//
+ e = modulo (d ,2)
+ w (1 , p ) = e
+ d = d /10;
+ d = floor ( d )
+ p = p +1;
+ end
+for n =1: p -1
+//multipliying the bits of decimal with their position values and adding//
+z = z + w (1 , n ) *(0.5) ^(11 - n ) ;
+end
+z = z *10000;
+//rounding of to 4 decimal values//
+z = round ( z ) ;
+z = z /10000;
+x=f+z;
+disp('The Decimal equivalent of the Binary number given is');
+disp(x);
+//Displaying the final result//
\ No newline at end of file diff --git a/462/CH2/EX2.3.b/ex_2_3_b.pdf b/462/CH2/EX2.3.b/ex_2_3_b.pdf Binary files differnew file mode 100755 index 000000000..94db11fb9 --- /dev/null +++ b/462/CH2/EX2.3.b/ex_2_3_b.pdf diff --git a/462/CH2/EX2.3.c/ex2_3_c.sce b/462/CH2/EX2.3.c/ex2_3_c.sce new file mode 100755 index 000000000..ef2e7bb6b --- /dev/null +++ b/462/CH2/EX2.3.c/ex2_3_c.sce @@ -0,0 +1,53 @@ +//example 2.3(c)//
+clc
+//clears the command window//
+clear
+//clears//
+p =1;
+//initialising//
+q =1;
+z =0;
+b =0;
+w =0;
+f =0;
+//bin= input ( ” Enter the binary no to be converted to its decimal equivalent : ”)
+//accepting the binary input from user//
+bin =1001.0101;
+d = modulo(bin,1) ;
+//separating the decimal part and the integer part//
+d= d *10^10;
+a = floor(bin) ;
+//removing the decimal part//
+while (a >0)
+// Loop to take the binary bits of integer into a matrix//
+r = modulo (a ,10) ;
+b(1,q) = r ;
+a=a/10;
+a=floor( a ) ;
+q = q +1;
+end
+for m =1: q -1
+// multipliying the bits of integer with their position values and adding//
+c=m -1;
+f=f+b(1,m)*(2^c);
+end
+while (d >0)
+ // Loop to take the binary bits of decimal into a matrix//
+ e = modulo (d ,2)
+ w (1 , p ) = e
+ d = d /10;
+ d = floor ( d )
+ p = p +1;
+ end
+for n =1: p -1
+//multipliying the bits of decimal with their position values and adding//
+z = z + w (1 , n ) *(0.5) ^(11 - n ) ;
+end
+z = z *10000;
+//rounding of to 4 decimal values//
+z = round ( z ) ;
+z = z /10000;
+x=f+z;
+disp('The Decimal equivalent of the Binary number given is');
+disp(x);
+//Displaying the final result//
\ No newline at end of file diff --git a/462/CH2/EX2.3.c/ex_2_3_c.pdf b/462/CH2/EX2.3.c/ex_2_3_c.pdf Binary files differnew file mode 100755 index 000000000..5f7919274 --- /dev/null +++ b/462/CH2/EX2.3.c/ex_2_3_c.pdf diff --git a/462/CH2/EX2.3.d/ex2_3_d.sce b/462/CH2/EX2.3.d/ex2_3_d.sce new file mode 100755 index 000000000..2896b8e09 --- /dev/null +++ b/462/CH2/EX2.3.d/ex2_3_d.sce @@ -0,0 +1,53 @@ +//example 2.3(d)//
+clc
+//clears the command window//
+clear
+//clears//
+p =1;
+//initialising//
+q =1;
+z =0;
+b =0;
+w =0;
+f =0;
+//bin= input ( ” Enter the binary no to be converted to its decimal equivalent : ”)
+//accepting the binary input from user//
+bin =0.10101;
+d = modulo(bin,1) ;
+//separating the decimal part and the integer part//
+d= d *10^10;
+a = floor(bin) ;
+//removing the decimal part//
+while (a >0)
+// Loop to take the binary bits of integer into a matrix//
+r = modulo (a ,10) ;
+b(1,q) = r ;
+a=a/10;
+a=floor( a ) ;
+q = q +1;
+end
+for m =1: q -1
+// multipliying the bits of integer with their position values and adding//
+c=m -1;
+f=f+b(1,m)*(2^c);
+end
+while (d >0)
+ // Loop to take the binary bits of decimal into a matrix//
+ e = modulo (d ,2)
+ w (1 , p ) = e
+ d = d /10;
+ d = floor ( d )
+ p = p +1;
+ end
+for n =1: p -1
+//multipliying the bits of decimal with their position values and adding//
+z = z + w (1 , n ) *(0.5) ^(11 - n ) ;
+end
+z = z *10000;
+//rounding of to 4 decimal values//
+z = round ( z ) ;
+z = z /10000;
+x=f+z;
+disp('The Decimal equivalent of the Binary number given is');
+disp(x);
+//Displaying the final result//
\ No newline at end of file diff --git a/462/CH2/EX2.3.d/ex_2_3_d.pdf b/462/CH2/EX2.3.d/ex_2_3_d.pdf Binary files differnew file mode 100755 index 000000000..388cf97ac --- /dev/null +++ b/462/CH2/EX2.3.d/ex_2_3_d.pdf diff --git a/462/CH2/EX2.30/ex_2_30.pdf b/462/CH2/EX2.30/ex_2_30.pdf Binary files differnew file mode 100755 index 000000000..fa680e8a5 --- /dev/null +++ b/462/CH2/EX2.30/ex_2_30.pdf diff --git a/462/CH2/EX2.30/ex_2_30.sce b/462/CH2/EX2.30/ex_2_30.sce new file mode 100755 index 000000000..ae7acf12e --- /dev/null +++ b/462/CH2/EX2.30/ex_2_30.sce @@ -0,0 +1,13 @@ +//example 2.30//
+//hexadecimal to binary conversion//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=hex2dec('29FA')
+//hexadecimal to decimal conversion//
+a=dec2bin(x)
+//decimal to binary conversion//
+disp('conversion of hexadecimal given no to its binary form is:')
+disp(a)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.31/ex_2_31.pdf b/462/CH2/EX2.31/ex_2_31.pdf Binary files differnew file mode 100755 index 000000000..500f0e3cb --- /dev/null +++ b/462/CH2/EX2.31/ex_2_31.pdf diff --git a/462/CH2/EX2.31/ex_2_31.sce b/462/CH2/EX2.31/ex_2_31.sce new file mode 100755 index 000000000..858b7c412 --- /dev/null +++ b/462/CH2/EX2.31/ex_2_31.sce @@ -0,0 +1,13 @@ +//example 2.31//
+//conversion of binary to hexadecimal//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=bin2dec('10100110101111')
+//binary to decimal conversion//
+a=dec2hex(x)
+//decimal to hexadecimal conversion//
+disp('conversion of given binary number to its hexadecimal form is:')
+disp(a)
+//answer in hexadecimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.33/ex_2_33.pdf b/462/CH2/EX2.33/ex_2_33.pdf Binary files differnew file mode 100755 index 000000000..0b0a94cff --- /dev/null +++ b/462/CH2/EX2.33/ex_2_33.pdf diff --git a/462/CH2/EX2.33/ex_2_33.sce b/462/CH2/EX2.33/ex_2_33.sce new file mode 100755 index 000000000..71fd865df --- /dev/null +++ b/462/CH2/EX2.33/ex_2_33.sce @@ -0,0 +1,13 @@ +//example 2.33//
+//conversion hexadecimal number to octal number//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=hex2dec('A72E')
+//hexadecimal to decimal conversion//
+a=dec2oct(x)
+//decimal to octal conversion//
+disp('conversion of given hexadecimal no to its octal form results in :')
+disp(a)
+//answer in octal form//
\ No newline at end of file diff --git a/462/CH2/EX2.35/ex_2_35.pdf b/462/CH2/EX2.35/ex_2_35.pdf Binary files differnew file mode 100755 index 000000000..93c35ff7e --- /dev/null +++ b/462/CH2/EX2.35/ex_2_35.pdf diff --git a/462/CH2/EX2.35/ex_2_35.sce b/462/CH2/EX2.35/ex_2_35.sce new file mode 100755 index 000000000..74a818606 --- /dev/null +++ b/462/CH2/EX2.35/ex_2_35.sce @@ -0,0 +1,16 @@ +//example 2.35//
+//addition of hexadecimal number//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=hex2dec('7F')
+//hexadecimal to decimal conversion//
+y=hex2dec('BA')
+z=x+y
+//addition//
+a=dec2hex(z)
+//decimal to hexadecimal conversion//
+disp('addition of given hexadecimal numbers results in :')
+disp(a)
+//answer in hexadecimal form//
\ No newline at end of file diff --git a/462/CH2/EX2.36.a/ex_2_36_a.pdf b/462/CH2/EX2.36.a/ex_2_36_a.pdf Binary files differnew file mode 100755 index 000000000..23e6f2d4e --- /dev/null +++ b/462/CH2/EX2.36.a/ex_2_36_a.pdf diff --git a/462/CH2/EX2.36.a/ex_2_36_a.sce b/462/CH2/EX2.36.a/ex_2_36_a.sce new file mode 100755 index 000000000..6a6bb7cfc --- /dev/null +++ b/462/CH2/EX2.36.a/ex_2_36_a.sce @@ -0,0 +1,22 @@ +//example 2.36(a)//
+//subtraction of hexadecimal number//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=hex2dec('3F')
+//hexadecimal to deciimal conversion//
+y=hex2dec('5C')
+z=x-y
+//subtraction//
+t=z*-1
+t1=dec2hex(t)
+//answer in hexadecimal form(modulus)//
+t2=bitcmp(t,8)
+//complement//
+t3=t2+1
+//2's complement//
+a=dec2bin(t3)
+//answer in 2's complement form
+disp('result of subtraction in 2''s compliment form is:')
+disp(a)
\ No newline at end of file diff --git a/462/CH2/EX2.36.b/ex_2_36_b.pdf b/462/CH2/EX2.36.b/ex_2_36_b.pdf Binary files differnew file mode 100755 index 000000000..3f5647d8d --- /dev/null +++ b/462/CH2/EX2.36.b/ex_2_36_b.pdf diff --git a/462/CH2/EX2.36.b/ex_2_36_b.sce b/462/CH2/EX2.36.b/ex_2_36_b.sce new file mode 100755 index 000000000..c92c6be9d --- /dev/null +++ b/462/CH2/EX2.36.b/ex_2_36_b.sce @@ -0,0 +1,21 @@ +//example 2.36(b)//
+//subtraction of hexadecimal numbers//
+clc
+//clears the screen//
+clear
+//clears already existing variables//
+x=hex2dec('C0')
+//hexadecimal to decimal conversion//
+y=hex2dec('7A')
+z=x-y
+//subtraction//
+a=dec2hex(z)
+//decimal to hexadecimal conversion//
+b=dec2bin(z)
+//decimal to binary conversion//
+disp('answer in hexadecimal form is:')
+disp(a)
+//answer in hexadecimal form//
+disp('answer in binary form is:')
+disp(b)
+//answer in binary number//
\ No newline at end of file diff --git a/462/CH2/EX2.4/ex_2_4.pdf b/462/CH2/EX2.4/ex_2_4.pdf Binary files differnew file mode 100755 index 000000000..9624442a0 --- /dev/null +++ b/462/CH2/EX2.4/ex_2_4.pdf diff --git a/462/CH2/EX2.4/ex_2_4.sce b/462/CH2/EX2.4/ex_2_4.sce new file mode 100755 index 000000000..3615e10f0 --- /dev/null +++ b/462/CH2/EX2.4/ex_2_4.sce @@ -0,0 +1,5 @@ +//example 2.4//
+ans=dec2bin(13)
+//conversion of decimal number to binary//
+disp(ans)
+//answer in binary form//
\ No newline at end of file diff --git a/462/CH2/EX2.5/ex_2_5.pdf b/462/CH2/EX2.5/ex_2_5.pdf Binary files differnew file mode 100755 index 000000000..bb1609b7c --- /dev/null +++ b/462/CH2/EX2.5/ex_2_5.pdf diff --git a/462/CH2/EX2.5/ex_2_5.sce b/462/CH2/EX2.5/ex_2_5.sce new file mode 100755 index 000000000..360f03235 --- /dev/null +++ b/462/CH2/EX2.5/ex_2_5.sce @@ -0,0 +1,36 @@ +//example 2.5//
+clc
+//clears the command window//
+clear
+//clears all the variables//
+q =0;
+b =0;
+s =0;
+//a=input(”Enter the decimal no to be converted to its binary equivalent: ”) ;
+//accepting the decimal input from user//
+a =0.65625;
+d = modulo (a ,1) ;
+//separating the decimal part and the integer part//
+a = floor ( a ) ;
+//removing the decimal part//
+while (a >0)
+//taking integer part into a matrix and convert to equivalent binary//
+x = modulo (a ,2) ;
+b = b + (10^ q ) * x ;
+a = a /2;
+a = floor ( a ) ;
+q = q +1;
+end
+for i =1:10
+//For values after decimal point converting to binary//
+d = d *2;
+q = floor ( d ) ;
+s = s + q /(10^ i ) ;
+ if d >=1 then
+ d =d -1;
+ end
+end
+k=b+s;
+disp('The binary equivalent of the given decimal number is =');
+disp(k);
+//displaying the final result .
diff --git a/462/CH2/EX2.6.a/ex_2_6_a.pdf b/462/CH2/EX2.6.a/ex_2_6_a.pdf Binary files differnew file mode 100755 index 000000000..3cde5e471 --- /dev/null +++ b/462/CH2/EX2.6.a/ex_2_6_a.pdf diff --git a/462/CH2/EX2.6.a/ex_2_6_a.sce b/462/CH2/EX2.6.a/ex_2_6_a.sce new file mode 100755 index 000000000..67ae4f722 --- /dev/null +++ b/462/CH2/EX2.6.a/ex_2_6_a.sce @@ -0,0 +1,36 @@ +//example 2.6(a)//
+clc
+//clears the command window//
+clear
+//clears all the variables//
+q =0;
+b =0;
+s =0;
+//a=input(”Enter the decimal no to be converted to its binary equivalent: ”) ;
+//accepting the decimal input from user//
+a =25.5;
+d = modulo (a ,1) ;
+//separating the decimal part and the integer part//
+a = floor ( a ) ;
+//removing the decimal part//
+while (a >0)
+//taking integer part into a matrix and convert to equivalent binary//
+x = modulo (a ,2) ;
+b = b + (10^ q ) * x ;
+a = a /2;
+a = floor ( a ) ;
+q = q +1;
+end
+for i =1:10
+//For values after decimal point converting to binary//
+d = d *2;
+q = floor ( d ) ;
+s = s + q /(10^ i ) ;
+ if d >=1 then
+ d =d -1;
+ end
+end
+k=b+s;
+disp('The binary equivalent of the given decimal number is =');
+disp(k);
+//displaying the final result//
\ No newline at end of file diff --git a/462/CH2/EX2.6.b/ex_2_6_b.pdf b/462/CH2/EX2.6.b/ex_2_6_b.pdf Binary files differnew file mode 100755 index 000000000..d707ee1f7 --- /dev/null +++ b/462/CH2/EX2.6.b/ex_2_6_b.pdf diff --git a/462/CH2/EX2.6.b/ex_2_6_b.sce b/462/CH2/EX2.6.b/ex_2_6_b.sce new file mode 100755 index 000000000..4f3278df5 --- /dev/null +++ b/462/CH2/EX2.6.b/ex_2_6_b.sce @@ -0,0 +1,36 @@ +//example 2.6(b)//
+clc
+//clears the command window//
+clear
+//clears all the variables//
+q =0;
+b =0;
+s =0;
+//a=input(”Enter the decimal no to be converted to its binary equivalent: ”) ;
+//accepting the decimal input from user//
+a =10.625;
+d = modulo (a ,1) ;
+//separating the decimal part and the integer part//
+a = floor ( a ) ;
+//removing the decimal part//
+while (a >0)
+//taking integer part into a matrix and convert to equivalent binary//
+x = modulo (a ,2) ;
+b = b + (10^ q ) * x ;
+a = a /2;
+a = floor ( a ) ;
+q = q +1;
+end
+for i =1:10
+//For values after decimal point converting to binary//
+d = d *2;
+q = floor ( d ) ;
+s = s + q /(10^ i ) ;
+ if d >=1 then
+ d =d -1;
+ end
+end
+k=b+s;
+disp('The binary equivalent of the given decimal number is =');
+disp(k);
+//displaying the final result .
diff --git a/462/CH2/EX2.6.c/ex_2_6_c.pdf b/462/CH2/EX2.6.c/ex_2_6_c.pdf Binary files differnew file mode 100755 index 000000000..9739f3f70 --- /dev/null +++ b/462/CH2/EX2.6.c/ex_2_6_c.pdf diff --git a/462/CH2/EX2.6.c/ex_2_6_c.sce b/462/CH2/EX2.6.c/ex_2_6_c.sce new file mode 100755 index 000000000..163729982 --- /dev/null +++ b/462/CH2/EX2.6.c/ex_2_6_c.sce @@ -0,0 +1,36 @@ +//example 2.6(c)//
+clc
+//clears the command window//
+clear
+//clears all the variables//
+q =0;
+b =0;
+s =0;
+//a=input(”Enter the decimal no to be converted to its binary equivalent: ”) ;
+//accepting the decimal input from user//
+a =0.6875;
+d = modulo (a ,1) ;
+//separating the decimal part and the integer part//
+a = floor ( a ) ;
+//removing the decimal part//
+while (a >0)
+//taking integer part into a matrix and convert to equivalent binary//
+x = modulo (a ,2) ;
+b = b + (10^ q ) * x ;
+a = a /2;
+a = floor ( a ) ;
+q = q +1;
+end
+for i =1:10
+//For values after decimal point converting to binary//
+d = d *2;
+q = floor ( d ) ;
+s = s + q /(10^ i ) ;
+ if d >=1 then
+ d =d -1;
+ end
+end
+k=b+s;
+disp('The binary equivalent of the given decimal number is =');
+disp(k);
+//displaying the final result//
\ No newline at end of file diff --git a/462/CH2/EX2.8.a/ex_2_8_a.pdf b/462/CH2/EX2.8.a/ex_2_8_a.pdf Binary files differnew file mode 100755 index 000000000..dd9452b96 --- /dev/null +++ b/462/CH2/EX2.8.a/ex_2_8_a.pdf diff --git a/462/CH2/EX2.8.a/ex_2_8_a.sce b/462/CH2/EX2.8.a/ex_2_8_a.sce new file mode 100755 index 000000000..bf6fcc9a6 --- /dev/null +++ b/462/CH2/EX2.8.a/ex_2_8_a.sce @@ -0,0 +1,11 @@ +//example 2.8(a)//
+//one's complement of binary number//
+clc
+//clears the screen//
+clear
+//clears all the existing variables//
+x=bin2dec('0100111001')
+//entering the data in binary form//
+ans=dec2bin(bitcmp(x,10))
+disp(ans);
+//result will be displayed//
\ No newline at end of file diff --git a/462/CH2/EX2.8.b/ex_2_8_b.pdf b/462/CH2/EX2.8.b/ex_2_8_b.pdf Binary files differnew file mode 100755 index 000000000..bd57c6e37 --- /dev/null +++ b/462/CH2/EX2.8.b/ex_2_8_b.pdf diff --git a/462/CH2/EX2.8.b/ex_2_8_b.sce b/462/CH2/EX2.8.b/ex_2_8_b.sce new file mode 100755 index 000000000..ed23b7e16 --- /dev/null +++ b/462/CH2/EX2.8.b/ex_2_8_b.sce @@ -0,0 +1,11 @@ +//example 2.8(b)//
+//one's complement of binary number//
+clc
+//clears the screen//
+clear
+//clears all the existing variables//
+x=bin2dec('11011010')
+//entering the data in binary form//
+ans=dec2bin(bitcmp(x,8))
+disp(ans);
+//result will be displayed//
\ No newline at end of file diff --git a/462/CH2/EX2.9.a/ex_2_9_a.pdf b/462/CH2/EX2.9.a/ex_2_9_a.pdf Binary files differnew file mode 100755 index 000000000..f1a4ae59a --- /dev/null +++ b/462/CH2/EX2.9.a/ex_2_9_a.pdf diff --git a/462/CH2/EX2.9.a/ex_2_9_a.sce b/462/CH2/EX2.9.a/ex_2_9_a.sce new file mode 100755 index 000000000..375c4a79c --- /dev/null +++ b/462/CH2/EX2.9.a/ex_2_9_a.sce @@ -0,0 +1,21 @@ +//example 2.9(a)//
+//representation in 1's complement form//
+clc
+//clears the screen//
+clear
+//clears all the existing variables//
+x=7
+//x=+7//y=-x//
+xb=dec2bin(7)
+//xb means binary conversion of x to its one's complement form//
+xc=dec2bin(bitcmp(7,4))
+//xc means conversion of y in its one's complement form//
+disp('displaying result of +7 and -7 in ones complement form')
+disp(x)
+printf("=")
+disp(xb)
+//displaying answer in one's complement form//
+disp(-x)
+printf("=")
+disp(xc)
+//answer in one's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.9.b/ex_2_9_b.pdf b/462/CH2/EX2.9.b/ex_2_9_b.pdf Binary files differnew file mode 100755 index 000000000..62ca0dcaf --- /dev/null +++ b/462/CH2/EX2.9.b/ex_2_9_b.pdf diff --git a/462/CH2/EX2.9.b/ex_2_9_b.sce b/462/CH2/EX2.9.b/ex_2_9_b.sce new file mode 100755 index 000000000..b192463ac --- /dev/null +++ b/462/CH2/EX2.9.b/ex_2_9_b.sce @@ -0,0 +1,20 @@ +//example 2.9(b)//
+//representation in 1's complement form//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=8
+//x=+8//y=-x//
+xb=dec2bin(8)
+//xb means binary conversion of x to its one's complement form//
+xc=dec2bin(bitcmp(8,5))
+//xc means conversion of y in its one's complement form//
+disp(x)
+printf("=")
+disp(xb)
+//displaying answer in one's complement form//
+disp(-x)
+printf("=")
+disp(xc)
+//answer in one's complement form//
\ No newline at end of file diff --git a/462/CH2/EX2.9.c/ex_2_9_c.pdf b/462/CH2/EX2.9.c/ex_2_9_c.pdf Binary files differnew file mode 100755 index 000000000..a8454a3cc --- /dev/null +++ b/462/CH2/EX2.9.c/ex_2_9_c.pdf diff --git a/462/CH2/EX2.9.c/ex_2_9_c.sce b/462/CH2/EX2.9.c/ex_2_9_c.sce new file mode 100755 index 000000000..ae50fa7da --- /dev/null +++ b/462/CH2/EX2.9.c/ex_2_9_c.sce @@ -0,0 +1,20 @@ +//example 2.9(c)//
+//representation in 1's complement form//
+clc
+//clears the window//
+clear
+//clears all the existing variables//
+x=15
+//x=+15//y=-x//
+xb=dec2bin(15)
+//xb means binary conversion of x to its one's complement form//
+xc=dec2bin(bitcmp(15,5))
+//xc means conversion of y in its one's complement form//
+disp(x)
+printf("=")
+disp(xb)
+//displaying answer in one's complement form//
+disp(-x)
+printf("=")
+disp(xc)
+//answer in one's complement form//
\ No newline at end of file |