Explain Sum of Weights method with example for Octal to Decimal-00331
This subjective question is related to the book/course vu cs201 Introduction to Programming. It can also be found in vu cs201 Mid Term Solved Past Paper No. 2.
Sum-of-Weights Method
Sum-of-weights as the name indicates sums the weights of the Binary Digits (bits) of a Binary Number which is to be represented in Decimal. The Sum-of-Weights method can be used to convert a Binary number of any magnitude to its equivalent Decimal representation.
In the Sum-of-Weights method an extended expression is written in terms of the Binary Base Number 2 and the weights of the Binary number to be converted. The weights correspond to each of the binary bits which are multiplied by the corresponding binary value. Binary bits having the value 0 do not contribute any value towards the final sum expression.
The Binary number 101102 is therefore written in the form of an expression having weights 0 1 2 ,2 ,22 ,23 AND 24 corresponding to the bits 0, 1, 1, 0 and 1 respectively.Weights 20AND 23 do not contribute in the final sum as the binary bits corresponding to these weights have the value 0.