summaryrefslogtreecommitdiff
path: root/45/CH10/EX10.13/example_10_13.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /45/CH10/EX10.13/example_10_13.sce
downloadScilab-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.13/example_10_13.sce')
-rwxr-xr-x45/CH10/EX10.13/example_10_13.sce28
1 files changed, 28 insertions, 0 deletions
diff --git a/45/CH10/EX10.13/example_10_13.sce b/45/CH10/EX10.13/example_10_13.sce
new file mode 100755
index 000000000..6e5020d7d
--- /dev/null
+++ b/45/CH10/EX10.13/example_10_13.sce
@@ -0,0 +1,28 @@
+//example 10.13
+clc;
+clear
+//pre=input("Enter the number where the counter is preset");
+pre = 1001; // given preset value
+q=1;
+b=0;
+f=0;
+a=pre;
+while(a>0) //converting to decimal
+ r=modulo(a,10);
+ b(1,q)=r;
+ a=a/10;
+ a=floor(a);
+ q=q+1;
+end
+for m=1:q-1
+ c=m-1
+ f = f + b(1,m)*(2^c);
+end
+disp("The counter will count down to 15 , Then preset back to %d, The resulting state diagram is shown below");
+for k=1:3
+for i=9:-1:0 // this will print the states
+printf('%d ',i);
+end;
+printf('15 ');
+
+end; \ No newline at end of file