blob: 175b26f37cb6d6c81a1dbdd54d252a2b86c0c87f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
//Example 2-33//
// -4 in two’s complement form by second method//
clc
//clears the window//
clear
//clears all existing variables//
x=bitcmp(4,8)
//complement of the decimal number 4(8 bit representation)//
y=1
z=x+y
//1 is added to the complement//
a=dec2bin(z)
//binary conversion of the decimal number//
disp(' -4 in two’s complement form is: ')
disp(a)
//result is displayed//
|