summaryrefslogtreecommitdiff
path: root/1241/CH2/EX2.34/exa2_34.sce
diff options
context:
space:
mode:
Diffstat (limited to '1241/CH2/EX2.34/exa2_34.sce')
-rwxr-xr-x1241/CH2/EX2.34/exa2_34.sce16
1 files changed, 16 insertions, 0 deletions
diff --git a/1241/CH2/EX2.34/exa2_34.sce b/1241/CH2/EX2.34/exa2_34.sce
new file mode 100755
index 000000000..6bda94c2b
--- /dev/null
+++ b/1241/CH2/EX2.34/exa2_34.sce
@@ -0,0 +1,16 @@
+//Example 2-34//
+// -17 in two’s complement form by second method//
+clc
+//clears the window//
+clear
+//clears all existing variables//
+x=bitcmp(17,8)
+//complement of the decimal number 17(8 bit representation)//
+y=1
+z=x+y
+//1 is added to the complement//
+a=dec2bin(z)
+//binary conversion of the decimal number//
+disp(' -17 in two’s complement form is: ')
+disp(a)
+//result is displayed//