summaryrefslogtreecommitdiff
path: root/2825/CH19/EX19.17/Ex19_17.sce
diff options
context:
space:
mode:
Diffstat (limited to '2825/CH19/EX19.17/Ex19_17.sce')
-rwxr-xr-x2825/CH19/EX19.17/Ex19_17.sce16
1 files changed, 16 insertions, 0 deletions
diff --git a/2825/CH19/EX19.17/Ex19_17.sce b/2825/CH19/EX19.17/Ex19_17.sce
new file mode 100755
index 000000000..106e5cbb9
--- /dev/null
+++ b/2825/CH19/EX19.17/Ex19_17.sce
@@ -0,0 +1,16 @@
+//Ex19_17 Pg-963
+clc
+
+//Integer part
+bin='1011'; //binary input
+dec_I=bin2dec(bin) //decimal output
+oct_I=dec2oct(dec_I) //octal output
+
+//Decimal part
+bin='11010'; //binary input
+dec_D=bin2dec(bin) //decimal output
+oct_D=dec2oct(dec_D) //octal output
+oct=oct_I + oct_D //final octal output
+b = strcat([ oct_I, oct_D ], '.' ) // combining intger and decimal part
+disp("The octal equivqlent of 1011.01101 is")
+disp(b)