This is my function that is supposed to take a base ten number and return the same number in a base 16(hexidecimal) format

ie. 45 returns 2D

instead I am getting 6850

```
string inttohex (int n)
{
ostringstream buffer;
string result;
int num;
num=n%16;
if(num<10) buffer<<(num+'0');
else {buffer<< ((num-10)+'A');}
n/=16;
if (n<10) buffer<<(n+'0');
else {buffer<< (n-10+'A');}
result=buffer.str();
return result;
}
```