summaryrefslogtreecommitdiff
path: root/2825/CH19/EX19.14/Ex19_14.sce
diff options
context:
space:
mode:
Diffstat (limited to '2825/CH19/EX19.14/Ex19_14.sce')
-rwxr-xr-x2825/CH19/EX19.14/Ex19_14.sce18
1 files changed, 18 insertions, 0 deletions
diff --git a/2825/CH19/EX19.14/Ex19_14.sce b/2825/CH19/EX19.14/Ex19_14.sce
new file mode 100755
index 000000000..c0b674391
--- /dev/null
+++ b/2825/CH19/EX19.14/Ex19_14.sce
@@ -0,0 +1,18 @@
+//Ex19_14 Pg-963
+clc
+
+disp("Conversion of decimal number 0.85 base to its octal equivalent ")
+a=[0.85] //0.75 value in textbook is wrong
+z=modulo(a,1)
+d=0
+for i=1:10//converting the values after the decimal point into octal
+ z=z*8
+ q=floor(z)
+ d=d+q/(10^i)
+ if z>=1 then
+ z=z-q
+ end
+end
+s=d
+printf("\n = %.6f",s);
+