diff --git a/maths/addition_without_arithmetic.py b/maths/addition_without_arithmetic.py index 4d76a695e..0439d65de 100644 --- a/maths/addition_without_arithmetic.py +++ b/maths/addition_without_arithmetic.py @@ -15,11 +15,12 @@ def add(first: int, second: int) -> int: -321 """ while second != 0: - carry = first & second # Calculate carry - first = first ^ second # Add without carry - second = carry << 1 # Prepare carry for next iteration + carry = first & second # Calculate carry + first = first ^ second # Add without carry + second = carry << 1 # Prepare carry for next iteration return first + if __name__ == "__main__": import doctest