mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-30 18:36:43 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
1c4493ab3f
commit
3f86505897
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user