summaryrefslogtreecommitdiff
path: root/911/CH2
diff options
context:
space:
mode:
Diffstat (limited to '911/CH2')
-rw-r--r--911/CH2/EX2.1.a/ex_2_1_a.pdfbin0 -> 109483 bytes
-rw-r--r--911/CH2/EX2.1.a/ex_2_1_a.sce10
-rw-r--r--911/CH2/EX2.1.b/ex_2_1_b.pdfbin0 -> 108990 bytes
-rw-r--r--911/CH2/EX2.1.b/ex_2_1_b.sce13
-rw-r--r--911/CH2/EX2.10/ex_2_10.pdfbin0 -> 110767 bytes
-rw-r--r--911/CH2/EX2.10/ex_2_10.sce19
-rw-r--r--911/CH2/EX2.12.a/ex_2_12_a.pdfbin0 -> 108993 bytes
-rw-r--r--911/CH2/EX2.12.a/ex_2_12_a.sce10
-rw-r--r--911/CH2/EX2.12.b/ex_2_12_b.pdfbin0 -> 109208 bytes
-rw-r--r--911/CH2/EX2.12.b/ex_2_12_b.sce13
-rw-r--r--911/CH2/EX2.13/ex_2_13.pdfbin0 -> 109256 bytes
-rw-r--r--911/CH2/EX2.13/ex_2_13.sce15
-rw-r--r--911/CH2/EX2.14/ex_2_14.pdfbin0 -> 110794 bytes
-rw-r--r--911/CH2/EX2.14/ex_2_14.sce18
-rw-r--r--911/CH2/EX2.15/ex_2_15.pdfbin0 -> 111080 bytes
-rw-r--r--911/CH2/EX2.15/ex_2_15.sce19
-rw-r--r--911/CH2/EX2.2/ex_2_2.pdfbin0 -> 109810 bytes
-rw-r--r--911/CH2/EX2.2/ex_2_2.sce13
-rw-r--r--911/CH2/EX2.3/ex_2_3.pdfbin0 -> 126520 bytes
-rw-r--r--911/CH2/EX2.3/ex_2_3_a.sce117
-rw-r--r--911/CH2/EX2.4/ex_2_4.pdfbin0 -> 108758 bytes
-rw-r--r--911/CH2/EX2.4/ex_2_4.sce12
-rw-r--r--911/CH2/EX2.5.a/ex_2_5_a.pdfbin0 -> 109142 bytes
-rw-r--r--911/CH2/EX2.5.a/ex_2_5_a.sce12
-rw-r--r--911/CH2/EX2.5.b/ex_2_5_b.pdfbin0 -> 109552 bytes
-rw-r--r--911/CH2/EX2.5.b/ex_2_5_b.sce14
-rw-r--r--911/CH2/EX2.7/ex_2_7.pdfbin0 -> 108664 bytes
-rw-r--r--911/CH2/EX2.7/ex_2_7.sce12
-rw-r--r--911/CH2/EX2.8.a/ex_2_8.pdfbin0 -> 110407 bytes
-rw-r--r--911/CH2/EX2.8.a/ex_2_8.sce18
-rw-r--r--911/CH2/EX2.8.b/ex_2_8_b.pdfbin0 -> 110786 bytes
-rw-r--r--911/CH2/EX2.8.b/ex_2_8_b.sce18
-rw-r--r--911/CH2/EX2.9/ex_2_9.pdfbin0 -> 108154 bytes
-rw-r--r--911/CH2/EX2.9/ex_2_9.sce11
34 files changed, 344 insertions, 0 deletions
diff --git a/911/CH2/EX2.1.a/ex_2_1_a.pdf b/911/CH2/EX2.1.a/ex_2_1_a.pdf
new file mode 100644
index 000000000..6fe5f60f8
--- /dev/null
+++ b/911/CH2/EX2.1.a/ex_2_1_a.pdf
Binary files differ
diff --git a/911/CH2/EX2.1.a/ex_2_1_a.sce b/911/CH2/EX2.1.a/ex_2_1_a.sce
new file mode 100644
index 000000000..dbb21dd4e
--- /dev/null
+++ b/911/CH2/EX2.1.a/ex_2_1_a.sce
@@ -0,0 +1,10 @@
+//example 2.1(a)//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=275.75;
+//numbers in decimal form//
+b=37.875;
+c=a+b;
+disp(c,'Addition of given two numbers = ') \ No newline at end of file
diff --git a/911/CH2/EX2.1.b/ex_2_1_b.pdf b/911/CH2/EX2.1.b/ex_2_1_b.pdf
new file mode 100644
index 000000000..6f3408864
--- /dev/null
+++ b/911/CH2/EX2.1.b/ex_2_1_b.pdf
Binary files differ
diff --git a/911/CH2/EX2.1.b/ex_2_1_b.sce b/911/CH2/EX2.1.b/ex_2_1_b.sce
new file mode 100644
index 000000000..50c9b0187
--- /dev/null
+++ b/911/CH2/EX2.1.b/ex_2_1_b.sce
@@ -0,0 +1,13 @@
+//example 2.1(b)//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=hex2dec('AF1')
+b=hex2dec('FFF')
+c=a+b;
+d=dec2bin(c);
+e=dec2hex(c);
+disp(c, ' addition of given numbers in decimal form = ')
+disp(d, ' addition of given numbers in binary form = ')
+disp(e, ' addition of given numbers in hexadecimal form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.10/ex_2_10.pdf b/911/CH2/EX2.10/ex_2_10.pdf
new file mode 100644
index 000000000..d81f66400
--- /dev/null
+++ b/911/CH2/EX2.10/ex_2_10.pdf
Binary files differ
diff --git a/911/CH2/EX2.10/ex_2_10.sce b/911/CH2/EX2.10/ex_2_10.sce
new file mode 100644
index 000000000..f667a06f5
--- /dev/null
+++ b/911/CH2/EX2.10/ex_2_10.sce
@@ -0,0 +1,19 @@
+// example 2.10//
+//division in hexadecimal//
+clc
+//clears the window//
+clear
+//clears already existing variables //
+x=hex2dec('AF')
+// x i s the first number //
+// hexadecimal to decimal conversion //
+y=hex2dec('09')
+//y is the second number w/c is to be divided//
+s=x/y;
+//division//
+disp (s,'the division of given numbers results in decimal form : ')
+a=round(s)
+a1=dec2hex(a)
+// decimal to hexadecimal conversion//
+disp (a1,'the division of given numbers results in hexadecimal form : ' )
+// answer in binary form// \ No newline at end of file
diff --git a/911/CH2/EX2.12.a/ex_2_12_a.pdf b/911/CH2/EX2.12.a/ex_2_12_a.pdf
new file mode 100644
index 000000000..82771f89d
--- /dev/null
+++ b/911/CH2/EX2.12.a/ex_2_12_a.pdf
Binary files differ
diff --git a/911/CH2/EX2.12.a/ex_2_12_a.sce b/911/CH2/EX2.12.a/ex_2_12_a.sce
new file mode 100644
index 000000000..2f07c9fa7
--- /dev/null
+++ b/911/CH2/EX2.12.a/ex_2_12_a.sce
@@ -0,0 +1,10 @@
+//example 2.12(a)//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=39;
+//numbers in decimal form//
+b=19;
+c=a+b;
+disp(c,'Addition of given two numbers = ') \ No newline at end of file
diff --git a/911/CH2/EX2.12.b/ex_2_12_b.pdf b/911/CH2/EX2.12.b/ex_2_12_b.pdf
new file mode 100644
index 000000000..9849a3ec7
--- /dev/null
+++ b/911/CH2/EX2.12.b/ex_2_12_b.pdf
Binary files differ
diff --git a/911/CH2/EX2.12.b/ex_2_12_b.sce b/911/CH2/EX2.12.b/ex_2_12_b.sce
new file mode 100644
index 000000000..89d3b95e7
--- /dev/null
+++ b/911/CH2/EX2.12.b/ex_2_12_b.sce
@@ -0,0 +1,13 @@
+//example 2.1(b)//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=hex2dec('1E')
+b=hex2dec('F3')
+c=a+b;
+d=dec2bin(c);
+e=dec2hex(c);
+disp(c, ' addition of given numbers in decimal form = ')
+disp(d, ' addition of given numbers in binary form = ')
+disp(e, ' addition of given numbers in hexadecimal form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.13/ex_2_13.pdf b/911/CH2/EX2.13/ex_2_13.pdf
new file mode 100644
index 000000000..a2a2b6c45
--- /dev/null
+++ b/911/CH2/EX2.13/ex_2_13.pdf
Binary files differ
diff --git a/911/CH2/EX2.13/ex_2_13.sce b/911/CH2/EX2.13/ex_2_13.sce
new file mode 100644
index 000000000..494084fa5
--- /dev/null
+++ b/911/CH2/EX2.13/ex_2_13.sce
@@ -0,0 +1,15 @@
+// example 2.13//
+//octal subtracttion//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=oct2dec('17');
+//given numbers//
+b=oct2dec('21');
+c=b-a;
+d=dec2bin(c,8)
+e=dec2oct(c)
+disp(c,'subtraction of given numbers in decimal form = ')
+disp(d,'subtraction of given numbers in binary form = ')
+disp(e,'subtraction of given numbers in octal form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.14/ex_2_14.pdf b/911/CH2/EX2.14/ex_2_14.pdf
new file mode 100644
index 000000000..d7b0d8af5
--- /dev/null
+++ b/911/CH2/EX2.14/ex_2_14.pdf
Binary files differ
diff --git a/911/CH2/EX2.14/ex_2_14.sce b/911/CH2/EX2.14/ex_2_14.sce
new file mode 100644
index 000000000..7702ca919
--- /dev/null
+++ b/911/CH2/EX2.14/ex_2_14.sce
@@ -0,0 +1,18 @@
+//example 2.14//
+//multiplication in binary form//
+clc
+//clears the screen //
+clear
+//clears all the existing variables //
+x=37
+//first number to be multiplied is x //
+//binary to decima l conversion //
+y= 10
+//second number to be multiplied is y //
+z=x*y
+//multiplication//
+a= dec2bin (z)
+//decimal to binary conversion //
+disp (a,'the multiplication of given numbers results in binary form = : ' )
+disp (z, 'the multiplication of given numbers results in decimal form =: ' )
+// answer in binary number // \ No newline at end of file
diff --git a/911/CH2/EX2.15/ex_2_15.pdf b/911/CH2/EX2.15/ex_2_15.pdf
new file mode 100644
index 000000000..d2f900fe2
--- /dev/null
+++ b/911/CH2/EX2.15/ex_2_15.pdf
Binary files differ
diff --git a/911/CH2/EX2.15/ex_2_15.sce b/911/CH2/EX2.15/ex_2_15.sce
new file mode 100644
index 000000000..fb5c00581
--- /dev/null
+++ b/911/CH2/EX2.15/ex_2_15.sce
@@ -0,0 +1,19 @@
+// example 2.15//
+//division in hexadecimal//
+clc
+//clears the window//
+clear
+//clears already existing variables //
+x=hex2dec('E3B')
+// x i s the first number //
+// hexadecimal to decimal conversion //
+y=hex2dec('1A')
+//y is the second number w/c is to be divided//
+s=x/y;
+//division//
+disp (s,'the division of given numbers results in decimal form : ')
+a=round(s)
+a1=dec2hex(a)
+// decimal to hexadecimal conversion//
+disp (a1,'the division of given numbers results in hexadecimal form : ' )
+// answer in binary form// \ No newline at end of file
diff --git a/911/CH2/EX2.2/ex_2_2.pdf b/911/CH2/EX2.2/ex_2_2.pdf
new file mode 100644
index 000000000..9c69a68c6
--- /dev/null
+++ b/911/CH2/EX2.2/ex_2_2.pdf
Binary files differ
diff --git a/911/CH2/EX2.2/ex_2_2.sce b/911/CH2/EX2.2/ex_2_2.sce
new file mode 100644
index 000000000..2016599fe
--- /dev/null
+++ b/911/CH2/EX2.2/ex_2_2.sce
@@ -0,0 +1,13 @@
+//example 2.2//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=14276;
+b=18490;
+c=a+b;
+if c<32767 then
+ disp('Yes 16 bit arithmetic operation can be used to add given numbers')
+ else
+ disp('NO 16 bit arithmetic operation can be used to add given numbers')
+end \ No newline at end of file
diff --git a/911/CH2/EX2.3/ex_2_3.pdf b/911/CH2/EX2.3/ex_2_3.pdf
new file mode 100644
index 000000000..a16623d3d
--- /dev/null
+++ b/911/CH2/EX2.3/ex_2_3.pdf
Binary files differ
diff --git a/911/CH2/EX2.3/ex_2_3_a.sce b/911/CH2/EX2.3/ex_2_3_a.sce
new file mode 100644
index 000000000..75544c240
--- /dev/null
+++ b/911/CH2/EX2.3/ex_2_3_a.sce
@@ -0,0 +1,117 @@
+// example 2.3.a//
+clc
+clear
+format('v',18);
+//bb=input ('enter the first number (in decimal):')//
+// aaa=input('enter the second number (negative):') ;
+aaa =-118
+bb =32;
+aa = -1* aaa ;
+a =0;
+q =0;
+while (aa >0)
+ //finding the binary equivalents//
+x= modulo (aa ,2) ;
+a= a + (10^ q)*x;
+aa=aa /2;
+aa= floor (aa);
+q=q+1;
+end
+r =0;
+b =0;
+while (bb >0)
+x= modulo (bb ,2) ;
+b= b + (10^ r)*x;
+bb=bb /2;
+bb= floor (bb);
+r=r+1;
+end
+m=b
+for i =1:16
+a1(i)= modulo (a ,10) ;
+a=a /10;
+a= round (a);
+p1(i) =0;
+b1(i)= modulo (b ,10) ;
+b=b /10;
+b= round (b);
+end
+p1 (1) =1;
+for i =1:16
+ //finding the 2's compliment of second number//
+a1(i)= bitcmp (a1(i) ,1);
+end
+car (1) =0;
+for i =1:16
+c1(i)= car (i)+a1(i)+ p1(i);
+if c1(i)== 2 then
+car (i +1) = 1;
+c1(i) =0;
+elseif c1(i)==3 then
+car (i +1)= 1;
+c1(i) =1;
+else
+car (i +1) =0;
+end ;
+end ;
+re =0;
+for i =1:16
+re=re +( c1(i) *(10^(i -1) ))
+end ;
+printf ( ' The binary representation of first number is ' );
+disp (m);
+printf ('The 2''s compliment of second number is ' );
+disp (re);
+a1=c1;
+ar (1) =0;
+for i =1:8
+c1(i)=ar(i)+a1(i)+ b1(i);
+// addin both the nmbers ( binary addition )
+if c1(i)== 2 then
+ // lower byte
+ar(i+1)= 1;
+c1(i) =0;
+elseif c1(i)==3 then
+ar(i+1)= 1;
+c1(i) =1;
+else
+ar(i+1) =0;
+end
+end
+c1 (9)=ar (9)
+re =0;
+format('v',18);
+for i =1:8
+re=re +( c1(i) *(10^(i -1) ))
+end
+printf ( ' The sum of lower bytes of two binary numbers is %d' ,re );
+printf ( ' with a carry is %d' ,ar (9));
+for i =9:16
+c1(i)=ar(i)+a1(i)+ b1(i);
+// upper byte//
+if c1(i)== 2 then
+ar(i+1)= 1;
+c1(i) =0;
+elseif c1(i)==3 then
+ar(i+1)= 1;
+c1(i) =1;
+else
+ar(i+1) =0;
+end
+end
+c1 (17) =ar (17) ;
+format ('v',25);
+ree =0;
+for i =9:16
+ree = ree +( c1(i) *(10^(i -9) ));
+end
+for i =9:16
+re=re +( c1(i) *(10^(i -1) ))
+end
+printf ( ' The sum of upper bytes of the given numbers is %d' ,ree);
+printf ( ' with a carry is %d ' ,ar (17) );
+//displaying results//
+printf (' The total sum is ' );
+disp (re);
+printf ( ' with a carry %d ' ,ar (17) );
+disp('when we were using 8 bit we were getting error as number crosses its limit. While in 16 bit we get our result in 2''s complement form which comes out to be -150') \ No newline at end of file
diff --git a/911/CH2/EX2.4/ex_2_4.pdf b/911/CH2/EX2.4/ex_2_4.pdf
new file mode 100644
index 000000000..264ca0db5
--- /dev/null
+++ b/911/CH2/EX2.4/ex_2_4.pdf
Binary files differ
diff --git a/911/CH2/EX2.4/ex_2_4.sce b/911/CH2/EX2.4/ex_2_4.sce
new file mode 100644
index 000000000..f43f3eef7
--- /dev/null
+++ b/911/CH2/EX2.4/ex_2_4.sce
@@ -0,0 +1,12 @@
+// example 2.4//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=bin2dec('1110');
+//given numbers//
+b=bin2dec('11011');
+c=b-a;
+d=dec2bin(c,8)
+disp(c,'subtraction of given numbers in decimal form = ')
+disp(d,'subtraction of given numbers in binary form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.5.a/ex_2_5_a.pdf b/911/CH2/EX2.5.a/ex_2_5_a.pdf
new file mode 100644
index 000000000..8d7a15908
--- /dev/null
+++ b/911/CH2/EX2.5.a/ex_2_5_a.pdf
Binary files differ
diff --git a/911/CH2/EX2.5.a/ex_2_5_a.sce b/911/CH2/EX2.5.a/ex_2_5_a.sce
new file mode 100644
index 000000000..1e567f70d
--- /dev/null
+++ b/911/CH2/EX2.5.a/ex_2_5_a.sce
@@ -0,0 +1,12 @@
+// example 2.5.a//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=-64;
+//given numbers//
+b=32;
+c=b-a;
+d=dec2bin(c,8)
+disp(c,'subtraction of given numbers in decimal form = ')
+disp(d,'subtraction of given numbers in binary form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.5.b/ex_2_5_b.pdf b/911/CH2/EX2.5.b/ex_2_5_b.pdf
new file mode 100644
index 000000000..b50176925
--- /dev/null
+++ b/911/CH2/EX2.5.b/ex_2_5_b.pdf
Binary files differ
diff --git a/911/CH2/EX2.5.b/ex_2_5_b.sce b/911/CH2/EX2.5.b/ex_2_5_b.sce
new file mode 100644
index 000000000..96dbff5bb
--- /dev/null
+++ b/911/CH2/EX2.5.b/ex_2_5_b.sce
@@ -0,0 +1,14 @@
+// example 2.5.b//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=hex2dec('29');
+//given numbers//
+b=hex2dec('4F');
+c=b-a;
+d=dec2bin(c,8)
+e=dec2hex(c)
+disp(c,'subtraction of given numbers in decimal form = ')
+disp(d,'subtraction of given numbers in binary form = ')
+disp(e,'subtraction of given numbers in hexadecimal form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.7/ex_2_7.pdf b/911/CH2/EX2.7/ex_2_7.pdf
new file mode 100644
index 000000000..37cc08214
--- /dev/null
+++ b/911/CH2/EX2.7/ex_2_7.pdf
Binary files differ
diff --git a/911/CH2/EX2.7/ex_2_7.sce b/911/CH2/EX2.7/ex_2_7.sce
new file mode 100644
index 000000000..fbbbbc8f8
--- /dev/null
+++ b/911/CH2/EX2.7/ex_2_7.sce
@@ -0,0 +1,12 @@
+// example 2.7//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=8;
+//given numbers//
+b=185;
+c=b-a;
+d=dec2bin(c,12)
+disp(c,'subtraction of given numbers in decimal form = ')
+disp(d,'subtraction of given numbers in binary form = ') \ No newline at end of file
diff --git a/911/CH2/EX2.8.a/ex_2_8.pdf b/911/CH2/EX2.8.a/ex_2_8.pdf
new file mode 100644
index 000000000..9a0c69c97
--- /dev/null
+++ b/911/CH2/EX2.8.a/ex_2_8.pdf
Binary files differ
diff --git a/911/CH2/EX2.8.a/ex_2_8.sce b/911/CH2/EX2.8.a/ex_2_8.sce
new file mode 100644
index 000000000..40353579d
--- /dev/null
+++ b/911/CH2/EX2.8.a/ex_2_8.sce
@@ -0,0 +1,18 @@
+//example 2.8//
+//multiplication in binary form//
+clc
+//clears the screen //
+clear
+//clears all the existing variables //
+x=bin2dec('100')
+//first number to be multiplied is x //
+//binary to decima l conversion //
+y= bin2dec ('10' )
+//second number to be multiplied is y //
+z=x*y
+//multiplication//
+a= dec2bin (z)
+//decimal to binary conversion //
+disp (a,'the multiplication of given numbers results in binary form = : ' )
+disp (z, 'the multiplication of given numbers results in decimal form =: ' )
+// answer in binary number // \ No newline at end of file
diff --git a/911/CH2/EX2.8.b/ex_2_8_b.pdf b/911/CH2/EX2.8.b/ex_2_8_b.pdf
new file mode 100644
index 000000000..d1138f998
--- /dev/null
+++ b/911/CH2/EX2.8.b/ex_2_8_b.pdf
Binary files differ
diff --git a/911/CH2/EX2.8.b/ex_2_8_b.sce b/911/CH2/EX2.8.b/ex_2_8_b.sce
new file mode 100644
index 000000000..d9b29fadd
--- /dev/null
+++ b/911/CH2/EX2.8.b/ex_2_8_b.sce
@@ -0,0 +1,18 @@
+//example 2.8//
+//multiplication in hexadecimal form//
+clc
+//clears the screen //
+clear
+//clears all the existing variables //
+x=hex2dec('2B')
+//first number to be multiplied is x //
+//hexadecimal to decima l conversion //
+y=hex2dec ('3' )
+//second number to be multiplied is y //
+z=x*y
+//multiplication//
+a= dec2hex(z)
+//decimal to hexadecimal conversion //
+disp (a,'the multiplication of given numbers results in hexadecimal form = : ' )
+disp (z, 'the multiplication of given numbers results in decimal form =: ' )
+// answer in binary number // \ No newline at end of file
diff --git a/911/CH2/EX2.9/ex_2_9.pdf b/911/CH2/EX2.9/ex_2_9.pdf
new file mode 100644
index 000000000..8eee41d56
--- /dev/null
+++ b/911/CH2/EX2.9/ex_2_9.pdf
Binary files differ
diff --git a/911/CH2/EX2.9/ex_2_9.sce b/911/CH2/EX2.9/ex_2_9.sce
new file mode 100644
index 000000000..e6aaba6ea
--- /dev/null
+++ b/911/CH2/EX2.9/ex_2_9.sce
@@ -0,0 +1,11 @@
+//example 2.9//
+clc
+//clears the screen//
+clear
+//clears all existing variables//
+a=bin2dec('110101')
+//binary to decimal conversion//
+b=bin2dec('1011')
+c=a/b;
+//division//
+disp(c,'division of given numbers =') \ No newline at end of file