From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 1964/CH15/EX15.11/ex15_11.sce | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 1964/CH15/EX15.11/ex15_11.sce (limited to '1964/CH15/EX15.11') diff --git a/1964/CH15/EX15.11/ex15_11.sce b/1964/CH15/EX15.11/ex15_11.sce new file mode 100755 index 000000000..b719ac2a9 --- /dev/null +++ b/1964/CH15/EX15.11/ex15_11.sce @@ -0,0 +1,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======================================================================================================= -- cgit