Ignoring leading zeros in the number:

bool isPalindrome(int N)
{
    int i = 0, j = N;
    while(n)
    {
        i = (i << 1) | (j & 1);
        j >= 1;
    }
    return(i == N);
}

Dave

On May 23, 2:11 pm, Piyush Sinha <ecstasy.piy...@gmail.com> wrote:
> Find whether the binary representation of a number is palindrome or
> not. The input begins with integer N.
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=100000655377926*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to