summaryrefslogtreecommitdiff
path: root/1241/CH2/EX2.42/exa2_42.sce
blob: 1f41b615cbf76ced9c25e4d130f7daf3c32f9e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//Example 2-42//
//ones complement of -13 by 2nd method//
clc
//clears the window//
clear
//clears all existing variables//
a=bitcmp(0,8)
//decimal equivalent of 11111111//
b=13
c=a-b
//subtracting 13 from decimal equivalent of 11111111//
z=dec2bin(c)
disp('ones complement of -13 is:')
disp(z)
//result is displayed//