To check if a binary number is palindrome, we can first convert it to a string and then check if the string is equal to its reverse. Here's the Python code to do that using loops:
main.py285 chars8 linesSome key points to note:
bin() function to convert the input number n to a binary string.// operator performs integer division, which ensures that we get the correct midpoint index in case the length of the binary string is odd.False as soon as a mismatch is found.True.gistlibby LogSnag