mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-02-10 05:47:03 +00:00
[PR #1524] Added Binary to Gray code #2136
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/TheAlgorithms/C/pull/1524
State: closed
Merged: No
Description of Change
Added a new algorithm to convert a binary number to its Gray code equivalent in the bit_manipulation directory.
The algorithm performs bitwise XOR between the binary number and its right-shifted version to generate the Gray code.
References
Checklist
Notes:
Added
binary_to_gray.c— a simple and efficient implementation using bitwise operators with example and validation logic.