blob: 7af8aef1accd51aca10f45c4bebf0d684f84bf84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
//Example 1.20: Addition of two unsigned numbers 14-10.
clc;
x=bitcmp(10,4) //finds complement of 5
y=1;
u=x+y //1 is added to the complement
w=14
z=w+u;
r = dec2bin(z); // binary equivalent of decimal number
disp('The binary number is = ');
disp(r)
disp('The msb is discarded, and binary number becomes')
disp('0100')
|