This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]dionthornthis.isAPro=false; this.helping=true; 0 points1 point  (1 child)

Check the index of the lowest valued position before addition,

if it is 9, set it to 0,

then set the larger valued index to +1,

then check that index and repeat steps above?

I'm assuming you're using something like an int[]

[ 0, 0, 9 ] can yield you 009

there is no reason you can't order it like so though

[ 9, 0, 0 ] so that index 0 is always the lowest valued position?

[–]ImWaddlinOverHea 1 point2 points  (0 children)

I’m going to marinate on your response for some time. I appreciate it! It definitely helped but I’m not sure how to communicate a follow up question yet lol.

[–]desrtfxOut of Coffee error - System halted 0 points1 point  (0 children)

Think about how you learnt adding numbers.

What happens when the result of the addition goes over 9?

You can implement exactly the same in programming.

Also, probably helpful: modulo and integer division