summaryrefslogtreecommitdiff
path: root/1241/CH2/EX2.34/exa2_34.sce
blob: 6bda94c2be75bd7b2d08948c4368efe3beda36cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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//