Skip to content
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

Implement XOR of Two Numbers without Using XOR Operator #1141

Closed
2 tasks
Kamini8707 opened this issue Oct 22, 2024 · 1 comment
Closed
2 tasks

Implement XOR of Two Numbers without Using XOR Operator #1141

Kamini8707 opened this issue Oct 22, 2024 · 1 comment

Comments

@Kamini8707
Copy link
Contributor

Kamini8707 commented Oct 22, 2024

Description:
I would like to add a new feature to the repository that implements the XOR operation for two numbers using only AND, OR, and NOT bitwise operators. This approach avoids the direct use of the XOR (^) operator and instead derives the XOR logic using fundamental bitwise operations.

Feature Details:
The XOR of two numbers can be computed using the formula:
XOR(A, B) = (A OR B) AND NOT (A AND B)
The program will take two integers as input and return the result of their XOR operation.
This addition will showcase how basic bitwise operations can be combined to replicate the behavior of more complex operators like XOR.

Example:
Input: 5, 3
Output: 6 (since 5 XOR 3 = 6)

Labels:
new algorithm, gssoc-ext, hacktoberfest, level2


Assignees:

  • Contributor in GSSoC-ext
  • Want to work on it
@Kamini8707
Copy link
Contributor Author

Please assign me this issue

@pankaj-bind pankaj-bind added the invalid This doesn't seem right label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants