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
What is nested structure with example?
What are header files? What are their uses?
Explain about the functions strcat() and strcmp()?
Do character constants represent numerical values?
What is the use of typedef in c?
How can I trap or ignore keyboard interrupts like control-c?
Why we use stdio h in c?
What is storage class?
Explain data types & how many data types supported by c?
How can a program be made to print the name of a source file where an error occurs?
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
What does 1f stand for?
What is cohesion in c?
Explain a file operation in C with an example.
Why c is procedure oriented?