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
Which are low level languages?
Why void main is used in c?
How many levels of indirection in pointers can you have in a single declaration?
write a program in c language to print your bio-data on the screen by using functions.
Explain how can you determine the size of an allocated portion of memory?
Describe the difference between = and == symbols in c programming?
What is a pointer value and address in c?
What are global variables?
What is a shell structure examples?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
How can I trap or ignore keyboard interrupts like control-c?
What is the difference between formatted&unformatted i/o functions?
Explain what header files do I need in order to define the standard library functions I use?
What are the Advantages of using macro
What is a stream in c programming?