diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /45/CH10/EX10.12/example_10_12.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '45/CH10/EX10.12/example_10_12.sce')
-rwxr-xr-x | 45/CH10/EX10.12/example_10_12.sce | 42 |
1 files changed, 42 insertions, 0 deletions
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)
+
|