diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3809/CH23/EX23.24/EX23_24.sce | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2 Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip |
initial commit / add all books
Diffstat (limited to '3809/CH23/EX23.24/EX23_24.sce')
-rw-r--r-- | 3809/CH23/EX23.24/EX23_24.sce | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/3809/CH23/EX23.24/EX23_24.sce b/3809/CH23/EX23.24/EX23_24.sce new file mode 100644 index 000000000..7f977d4c3 --- /dev/null +++ b/3809/CH23/EX23.24/EX23_24.sce @@ -0,0 +1,49 @@ +//Chapter 23, Example 23.16
+clc
+
+a=11100001110110 //input BCD digits
+z =0;
+
+d= modulo (a ,10000)
+for j =1:3
+ y(j)= modulo (d ,10)
+ z=z+(y(j) *(2^(j -1)))
+ d=d/10
+ d= floor (d)
+end
+
+b=a /10000
+b= floor (b)
+c= modulo (b ,10000)
+z1 =0
+for j =1:3
+ y(j)= modulo (c ,10)
+ z1=z1 +(y(j) *(2^(j -1) ))
+ c=c/10
+ c= floor (c)
+end
+
+e=b /10000
+e= floor (e)
+e1= modulo (e ,10000)
+z2 =0
+for j =1:4
+ y(j)= modulo (e1 ,10)
+ z2=z2 +(y(j) *(2^(j -1) ))
+ e1=e1/10
+ e1= floor (e1)
+end
+
+f=e /10000
+f= floor (f)
+z3 =0
+for j =1:2
+ y(j)= modulo (f ,10)
+ z3=z3 +(y(j) *(2^(j -1) ))
+ f=f/10
+ f= floor (f)
+end
+
+
+r=z3*1000+z2 *100+ z1 *10+ z
+printf ( '(11100001110110)BCD to Decimal = %d ' ,r) //display of decimal numbers
|