State the two steps of how
data gets converted into
binory?
Answers
Answer:
[′bīn·ə·rē kən′vər·zhən] (computer science) Converting a number written in binary notation to a number system with another base, such as decimal, octal, or hexadecimal
Please mark as brainliest wnd kindly follow
Given a binary string str, the task is to print the numbers of steps required to convert it to one by the following operations:
If ‘S’ is odd add 1 to it.
If ‘S’ is even divide it by 2.
Examples:
Input: str = “1001001”
Output: 12
Input: str = “101110”
Output: 8
Number ‘101110’ is even, after dividing it by 2 we get an odd number ‘10111’ so we will add 1 to it. Then we’ll get ‘11000’ which is even and can be divide three times continuously in a row and get ’11’ which is odd, adding 1 to it will give us ‘100’ which is even and can be divided 2 times in a row. As, a result we get 1.
So 8 times the above two operations were required in this number