need some help with binary addition.

can someone help me with binary addition? i know how it works on paper but when it comes to actually coding it, i cant seem to get it as the addition gives the result of regular addition. for example i know the following

0+0=0

1+0=1

1+1=10 , 1 is carried and 0 is placed.

now when i have 110 + 111 it gives me 221.

what i was thinking of doing is replace the numbers, for example if the last number is 0 and the last number of the second number is 1 then the output is 1. so i would use some if statements, but if doing this then i will have to use some sort of array or something which confuses me and i have no idea how to get past that problem. any suggestions of what i could do?