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 --- 2522/CH10/EX10.2/exm10_2.sce | 36 ++++++++++++++++++++++++++++++++++++ 2522/CH10/EX10.2/exm10_2_output.jpg | Bin 0 -> 28224 bytes 2 files changed, 36 insertions(+) create mode 100755 2522/CH10/EX10.2/exm10_2.sce create mode 100755 2522/CH10/EX10.2/exm10_2_output.jpg (limited to '2522/CH10/EX10.2') diff --git a/2522/CH10/EX10.2/exm10_2.sce b/2522/CH10/EX10.2/exm10_2.sce new file mode 100755 index 000000000..8936f99e5 --- /dev/null +++ b/2522/CH10/EX10.2/exm10_2.sce @@ -0,0 +1,36 @@ +// page no 321 +// example no 10.2 +// ADDITION OF PACKED BCD NUMBERS +clc; +a=77; +b=48; +x=modulo(a,10); +y=modulo(b,10); +z=x+y; +if z>9 then + f=z+6; + + printf('After addition BCD1 is: ') + disp(dec2bin(f)); + printf('MSB of this sequence is the carry generated after addition. \n \n') +else + printf('After addition BCD1 is: ') + disp(z); +end +x=a/10; +x=floor(x); +y=b/10; +y=floor(y); +z=x+y; +if z>9 then + f=z+6; + f=f+1; // this 1 is the carry of BCD1. + printf('After addition BCD2 is: ') + disp(dec2bin(f)); + printf('MSB of this sequence is the carry generated after addition.') +else + printf('After addition BCD1 is: ') + disp(z); +end +printf('\n \n BCD1 : 0101 \n \n'); +printf('BCD2: 0010') diff --git a/2522/CH10/EX10.2/exm10_2_output.jpg b/2522/CH10/EX10.2/exm10_2_output.jpg new file mode 100755 index 000000000..5302b5a43 Binary files /dev/null and b/2522/CH10/EX10.2/exm10_2_output.jpg differ -- cgit