Hello!
I am trying to make a program that turns any number with decimal base in number with any base from 2-16, but the program I have written gives me the number in reverse order. I tried to combine my program with a regular program that give a reverse number for number that has been entered, but then my program just returns 0000 all the time. I have no idea how I should do it, so I would be thankful for any help! Here is what I have done - it returns the reverse of what is needed.
You could store the ASCII digits in a string and then reverse the string. Another way is to just use a character array of sufficient size and store the ASCII digits starting at the back and working your way forwards.
You can convert the binary digit to ASCII using a trick like this:
1 2 3 4 5
constchar table[] = "0123456789ABCDEF";
char ch;
...
c = m % n;
ch = table[c];