summaryrefslogtreecommitdiff
path: root/1964/CH15/EX15.11/ex15_11.sce
diff options
context:
space:
mode:
Diffstat (limited to '1964/CH15/EX15.11/ex15_11.sce')
-rwxr-xr-x1964/CH15/EX15.11/ex15_11.sce17
1 files changed, 17 insertions, 0 deletions
diff --git a/1964/CH15/EX15.11/ex15_11.sce b/1964/CH15/EX15.11/ex15_11.sce
new file mode 100755
index 000000000..b719ac2a9
--- /dev/null
+++ b/1964/CH15/EX15.11/ex15_11.sce
@@ -0,0 +1,17 @@
+//Chapter-15, Example 15.11, Page 500
+//=============================================================================
+clc
+clear
+//CALCULATIONS
+x1=base2dec(['1001'],2)//converting binary to decimal
+x2=base2dec(['0100'],2)//converting binary to decimal
+x3=x1+x2;
+if(x3>9)
+ x3=x3+6;
+ z1=dec2base(x3,2)//converting decimal to binary
+else
+ z1=dec2base(x3,2)//converting decimal to binary
+end
+disp(z1)
+//note:last 4 bits represent 3 and 5th bit prefixed with 3 bits will look as 1.hence the combined result will be 13
+//=================================END OF PROGRAM=======================================================================================================