Shortened logic for computing carry in problem 16 c++