find a number whether it is even or odd without using any
control structures and relational operators?
Answer Posted / ramya
A number anded with the lower number that is n & (n - 1) =
0 then it is even if it is anything else it is odd
odd_even (int n)
{
if (!(n & (n -1))
number is odd
else
number is even
}
| Is This Answer Correct ? | 9 Yes | 29 No |
Post New Answer View All Answers
What are reserved words with a programming language?
What is the purpose of main() function?
What are valid operations on pointers?
What oops means?
What is actual argument?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What are variables c?
write a program for the normal snake games find in most of the mobiles.
Do you know null pointer?
What is static identifier?
write a program to display all prime numbers
Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent
Why does the call char scanf work?
What is volatile variable in c?
What is the advantage of a random access file?