1+ 1 = 11. Or at least I would like it for it to...

I would like to combine 2 INTs into one, but I do not want the sum, I what them placed next to each other. So if the first number is 4 and the second number is 8, I would like to combine them to one INT that would be 48.

Is there a way to write this mathematically? I guessed something like “DesiredNumber = (Number[1]&Number[2])” but of cause my guess was fail.

Any ideas?

Converting to string is safest. It's easier to optimize working code than to debug optimized code.

int a = 1;
int b = 1;
int newNumber = int.Parse(a.ToString() + b.ToString());

http://stackoverflow.com/questions/1014292/concatenate-integers-in-c-sharp

I’m not sure what language you’re using, but the answer for C# is:


DesiredNumber = number1.ToString() + number2.ToString(); // C# Code example

Well, assuming you're using a decimal system, you can always just use the way decimal works-

total = (number1 * 10) + number2

You then work backwards from the total number of things.

int ConatenateIntegers(int[] numbers)
{
    int multiplier = 1;
    int total = 0;
    for(int i = numbers.Length - 1, i >= 0, i--)
    {
        total += (numbers _* multiplier)_
 _multiplier = multiplier * 10;_
 *}*
*}*
*```*
*<p>I think that'd do it? Check my maths.</p>*