Skip to content

addition_without_arithmetic #6830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Oct 30, 2022
Merged
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions maths/Addition_without_arithmetic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
first = int(input("Enter the number for first: "))
sec = int(input("Enter the number for sec: "))


def add(first, sec): # Create a function

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file maths/Addition_without_arithmetic.py, please provide doctest for the function add

Please provide return type hint for the function: add. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: first

Please provide type hint for the parameter: sec

while sec != 0:

c = first & sec

first = first ^ sec

sec = c << 1
return first


print("Sum of two numbers", add(first, sec)) # call the function
# Display sum of two numbers