Today’s interview question comes from Apple:

Write a program to add two integers. You may not use the + (addition) operator, but may use the ++ (increment by 1) or -- (decrement by 1) operators. Be sure your solution works for both positive and negative inputs.

Your task is to write a program to add two integers. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Pages: 1 2