1
base number conversions
Tjaycool17 (0)

In the first function of the of the program, it converts a base 10 number into a base 4 number, however it drops the leading zero if there are leading zeros in the base 4 number. how do I program it to keep the leading zeros.

How would I code this to be able to covert a batch of base 4 numbers to decimal or base 10 and vice versa?

You are viewing a single comment. View All
1
TheDrone7 (503)

There is no default way for saving the leading zeroes that I know of. A workaround that I can suggest is to first convert the number to a string and then save the leading zeroes in another string and after converting the number, just join the already saved leading zeroes and the new number converted to string.

1
Tjaycool17 (0)

@TheDrone7 Thanks, I will give it a try.

1
TheDrone7 (503)

@Tjaycool17 also, be sure to keep it a string by default. It'll lose the zeroes as soon as converted to a number.