summaryrefslogtreecommitdiff
path: root/2825/CH19/EX19.17/Ex19_17.sce
blob: 106e5cbb9596d5ea70f44acc7ecf80853d3c21d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)