java program

  • 13 years ago

     any one knows the code to find the given number is odd or even using the bitwise operators

  • 13 years ago

    Odd numbers have a 1 as last bit and Even have a 0 as last bit, so

    even=(<variable> & 1)==0

    odd=(<variable> & 1)==1

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.” - Jamie Zawinski