Is there you need to count the digits in a given numeral then it will take you some time. And even after you may be confused that "Have I counted it right or not?😕"
So do not worry about that thing now. Here I am sharing a trick to do so.
Follow the steps:
1) First convert a number into decimal.
e.g. If you have given (100110)2 then first convert it into a decimal that is (38)10.
2) Now use this easiest formula
count = floor(logm(n)) + 1 ; m = 2 if count digits of binary
m = 10 if count digits of decimal and so on.
n = number in decimal
LET US UNDERSTAND MORE WITH AN EXAMPLE.
Given number: (11010)2
The given number is a binary number. n = 2
So First, convert it into decimal m = (26)2
count = floor(logm(n)) + 1 |
count = floor(log2(26)) + 1 |floor(log10(26)) + 1
count = 4 + 1 = 5 |1 + 1 = 2
Digits counted in a binary number of 26 is 5.
Hope You use it.😃
Top comments (0)