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 a structure and why it is used?
Explain what is wrong with this statement? Myname = ?robin?;
How can I read and write comma-delimited text?
Compare and contrast compilers from interpreters.
What is cohesion in c?
Describe the order of precedence with regards to operators in C.
Write a program to check whether a number is prime or not using c?
Can static variables be declared in a header file?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
What is sorting in c plus plus?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
What is the difference between a function and a method in c?
What is the difference between malloc() and calloc()?
What is meant by initialization and how we initialize a variable?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)