find a number whether it is even or odd without using any
control structures and relational operators?
Answer Posted / asad
int oddeven(int n)
{
if(n&1)
return 1; //odd
else
return 0; //even
}
| Is This Answer Correct ? | 2 Yes | 7 No |
Post New Answer View All Answers
How do you determine whether to use a stream function or a low-level function?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What is the use of #define preprocessor in c?
How the c program is executed?
Do you know the purpose of 'register' keyword?
Explain the difference between exit() and _exit() function?
How can I sort more data than will fit in memory?
Is it better to bitshift a value than to multiply by 2?
What are loops in c?
What is difference between class and structure?
while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above
What does 3 mean in texting?
Is c dynamically typed?
Write a program to find the biggest number of three numbers in c?
What are c preprocessors?