Convert number base 10 to number base x both contained a string.

How would you convert say
"238273615237287352536266362524382737272" base 10 to a base x number contained within a string of characters?
How would you convert a number in base10 to some other base. For example, how would your convert 256 to base 16 ?
If you have steps, you can try converting the steps into code and post it. Doesn't matter if that's working or not.
Here is a way to convert from bases.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <stdlib.h>

int main ()
{
  int i;
  char buffer [33];
  printf ("Enter a number: ");
  scanf ("%d",&i);
  itoa (i,buffer,10);
  printf ("decimal: %s\n",buffer);
  itoa (i,buffer,16);
  printf ("hexadecimal: %s\n",buffer);
  itoa (i,buffer,2);
  printf ("binary: %s\n",buffer);
  return 0;
}
Last edited on
Topic archived. No new replies allowed.