summaryrefslogtreecommitdiff
path: root/3809/CH26/EX26.4/EX26_4.sce
diff options
context:
space:
mode:
Diffstat (limited to '3809/CH26/EX26.4/EX26_4.sce')
-rw-r--r--3809/CH26/EX26.4/EX26_4.sce14
1 files changed, 14 insertions, 0 deletions
diff --git a/3809/CH26/EX26.4/EX26_4.sce b/3809/CH26/EX26.4/EX26_4.sce
new file mode 100644
index 000000000..33ea89a9f
--- /dev/null
+++ b/3809/CH26/EX26.4/EX26_4.sce
@@ -0,0 +1,14 @@
+//Chapter 26, Example 26.4
+
+clc
+//Initialisation
+x=5 //decimal number to be convert
+y=65536 //2^16 decimal number
+
+
+//Calculation
+z=y-x //subtraction from 2^16 number
+z1=dec2bin(z) //conversion to binary
+
+//Results
+printf("-5 as a 16 bit signed number = %s",z1)