diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1241/CH2/EX2.31 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1241/CH2/EX2.31')
-rwxr-xr-x | 1241/CH2/EX2.31/exa2_31.sce | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/1241/CH2/EX2.31/exa2_31.sce b/1241/CH2/EX2.31/exa2_31.sce new file mode 100755 index 000000000..7df6134b3 --- /dev/null +++ b/1241/CH2/EX2.31/exa2_31.sce @@ -0,0 +1,26 @@ +//Example 2-31//
+// -4,-15,-17 in two’s complement form//
+clc
+//clears the console//
+clear
+//clears all existing variables//
+x=2^12
+//Smallest nine bit number//
+p=4
+q=15
+r=17
+u=x-p
+v=x-q
+w=x-r
+//subtraction//
+a=dec2bin(u)
+b=dec2bin(v)
+c=dec2bin(w)
+//binary conversion of the decimal number//
+disp(' -4 in two’s complement form is ')
+disp(a)
+disp(' -15 in two’s complement form is ')
+disp(b)
+disp(' -17 in two’s complement form is ')
+disp(c)
+//answers in binary form//
|