how to merge arrays into one.

Hi Guys.
Happy new year to all. New semester kick off and program started, so I have a small question. I just want to know how to merge arrays into one integer. for e.g.

int ary[3];
int temp;

ary[0] = 1;
ary[1] = 2;
ary[2] = 5;

I want to put all the values in three arrays into temp. So, that it will be like 125 in words (one hundred twenty five).
Thank you guys. See you again. bye.

in this case temp = ary[2]+10*ary[1]+10*10*ary[0]. to make it loopable you have to see that (if at first temp = 0) you keep adding ary[n]*k to it where n starts from array length -1 and decreases by one until it reaches 0 and k starts form 1 and increases 10 times on every cycle.
Last edited on
Topic archived. No new replies allowed.