diff options
Diffstat (limited to '3836/CH21/EX21.1')
-rw-r--r-- | 3836/CH21/EX21.1/Ex21_1.sce | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/3836/CH21/EX21.1/Ex21_1.sce b/3836/CH21/EX21.1/Ex21_1.sce new file mode 100644 index 000000000..8187556cf --- /dev/null +++ b/3836/CH21/EX21.1/Ex21_1.sce @@ -0,0 +1,17 @@ +clear +//Initialization +ni=11010 //binary number + +//Calculation +deci = 0 +i = 0 +while ni>0 + rem = ni-int(ni/10.)*10 + ni = int(ni/10.) + deci = deci + rem*2**i + i = i + 1 + +end +//Declaration +printf("\n Decimal Equivalent = %f",deci) + |