find a number whether it is even or odd without using any
control structures and relational operators?
Answer Posted / vishal jain
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i;
printf("Enter any Number : \n");
scanf("%d",&num);
i=num&1;
if(i==1)
{
printf("ODD");
}
else
{
printf("EVEN");
}
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How can I write a function that takes a format string and a variable number of arguments?
Can a variable be both constant and volatile?
Why is %d used in c?
When should a far pointer be used?
what is bit rate & baud rate? plz give wave forms
Explain what’s a signal? Explain what do I use signals for?
What do you mean by invalid pointer arithmetic?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
Explain what does the function toupper() do?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
How can I implement a delay, or time a users response, with sub-second resolution?
What does typeof return in c?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Write a program in c to replace any vowel in a string with z?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?