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 --- 45/CH10/EX10.12/example_10_12.sce | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 45/CH10/EX10.12/example_10_12.sce (limited to '45/CH10/EX10.12/example_10_12.sce') diff --git a/45/CH10/EX10.12/example_10_12.sce b/45/CH10/EX10.12/example_10_12.sce new file mode 100755 index 000000000..258fea5ba --- /dev/null +++ b/45/CH10/EX10.12/example_10_12.sce @@ -0,0 +1,42 @@ +//example 10.12 +clc +clear +//pro= ('Enter the value to whic counter should progress:'); +pro =11; // given input +q=1; +aa=pro; +for i=1:4 //converting the given number in to binary + x=modulo(aa,2); + b(q)=x; + aa=aa/2; + aa=floor(aa); + q=q+1; +end + +bi=' '; // then printing the NAND gate inputs +for i=1:4 + if i==1 & b(i)==1 then + bi=strcat([bi 'Qa']); + elseif i==1 & b(i)== 0 ; + bi=strcat([bi 'Qa''']); + end + if i==2 & b(i)==1 then + bi=strcat([bi 'Qb']); + elseif i==2 & b(i)== 0 ; + bi=strcat([bi 'Qb''']); + end + if i==3 & b(i)==1 then + bi=strcat([bi 'Qc']); + elseif i==3 & b(i)== 0 ; + bi=strcat([bi 'Qc''']); + end + if i==4 & b(i)==1 then + bi=strcat([bi 'Qd']); + elseif i==4 & b(i)== 0 ; + bi=strcat([bi 'Qd''']); + end + +end +disp('The NAND gate inputs must be :'); +disp(bi) + -- cgit