find a number whether it is even or odd without using any
control structures and relational operators?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / guest
#include<stdio.h>
#include<conio.h>
void main()
{
int x;
if(x%2==0)
printf("even");
else
printf("odd");
getch();
}
Is This Answer Correct ? | 4 Yes | 25 No |
Explain the use of function toupper() with and example code?
Dear Sir, we are required the bubble sorting programs Regs Prem
WRITE A PROGRAM TO FIND A REVERSE OF TWO NO
Is main is a keyword in c?
Describe dynamic data structure in c programming language?
How can I access a memory located at certain address?
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
Explain why C language is procedural?
Why pointers are used?
In which layer of the network datastructure format change is done
Do you know pointer in c?
What are the advantages of Macro over function?