Is it possible to convert a binary pattern to decimal pattern consists of 0's and 1's without loop (iterations).
Suppose if I have.
Binary Pattern I need in Decimal
1 1
10 10
100 100
I need it in c-programming, So binary pattern I have in integer (int
).
Binary Pattern number I need in Decimal
1 1 * 1 1
10 2 * 5 10
100 4 * 25 100
1000 8 * 1000
* means multiply
So what I need a mathematical equation that gives me 10(number-1), without loop. This is power function actually but we don't have power operator in C language.
First, I don't know whether I am asking for impossible thing?