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
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
What are the scope of static variables?
What is the translation phases used in c language?
I heard that you have to include stdio.h before calling printf. Why?
How are variables declared in c?
What is the difference between c &c++?
What is a program flowchart?
What does %d do in c?
What is the difference between malloc calloc and realloc in c?
Explain what is output redirection?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What is spaghetti programming?
What is the use of #define preprocessor in c?