summaryrefslogtreecommitdiff
path: root/1964/CH15/EX15.11/ex15_11.sce
blob: b719ac2a97a69c7025a8833ac7f344710b62ae2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Chapter-15, Example 15.11, Page 500
//=============================================================================
clc
clear
//CALCULATIONS
x1=base2dec(['1001'],2)//converting binary to decimal
x2=base2dec(['0100'],2)//converting binary to decimal
x3=x1+x2;
if(x3>9)
    x3=x3+6;
    z1=dec2base(x3,2)//converting decimal to binary
else
    z1=dec2base(x3,2)//converting decimal to binary
end
disp(z1)
//note:last 4 bits represent 3 and 5th bit prefixed with 3 bits will look as 1.hence the combined result will be 13
//=================================END OF PROGRAM=======================================================================================================