summaryrefslogtreecommitdiff
path: root/3860/CH1/EX1.20/Ex1_20.sce
diff options
context:
space:
mode:
Diffstat (limited to '3860/CH1/EX1.20/Ex1_20.sce')
-rw-r--r--3860/CH1/EX1.20/Ex1_20.sce13
1 files changed, 13 insertions, 0 deletions
diff --git a/3860/CH1/EX1.20/Ex1_20.sce b/3860/CH1/EX1.20/Ex1_20.sce
new file mode 100644
index 000000000..7af8aef1a
--- /dev/null
+++ b/3860/CH1/EX1.20/Ex1_20.sce
@@ -0,0 +1,13 @@
+//Example 1.20: Addition of two unsigned numbers 14-10.
+clc;
+x=bitcmp(10,4) //finds complement of 5
+y=1;
+u=x+y //1 is added to the complement
+w=14
+z=w+u;
+r = dec2bin(z); // binary equivalent of decimal number
+disp('The binary number is = ');
+disp(r)
+disp('The msb is discarded, and binary number becomes')
+disp('0100')
+