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.38 | |
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.38')
-rwxr-xr-x | 1241/CH2/EX2.38/exa2_38.sce | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/1241/CH2/EX2.38/exa2_38.sce b/1241/CH2/EX2.38/exa2_38.sce new file mode 100755 index 000000000..b9dfdd3ef --- /dev/null +++ b/1241/CH2/EX2.38/exa2_38.sce @@ -0,0 +1,23 @@ +//Example 2-38//
+//add -17 to -30//
+clc
+//clears the console//
+clear
+//clears all exisiting variables//
+x=bitcmp(17,8)
+y=bitcmp(30,8)
+//complement of the decimal numbers 17 and 30//
+z=1
+u=x+z
+v=y+z
+//1 is added to the complements//
+w=u+v
+a=dec2bin(w)
+//binary conversion of the decimal number//
+disp('binary form of number obtained by adding -17 to -30')
+disp(a)
+//result is displayed//
+disp(' the msb is discarded,so eight bit representation is the answer in binary form ')
+a=dec2bin(w-(2^8))
+disp(a)
+//final result is displayed//
|