I want to write a program to convert from decimal to negabinary.
I cannot figure out how to convert from decimal to negabinary.
I do not know how to find the rule and how it works.
Example: 7(base10)-->11011(base-2)
I just know that this is 7 = (-2)^0*1 + (-2)^1*1 + (-2)^2*0 + (-2)^3*1 + (-2)^4*1 .
algorithm base base-conversion
Jason
source share