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 are operators in c?
What is derived datatype in c?
How can I prevent another program from modifying part of a file that I am modifying?
Why ca not I do something like this?
Can static variables be declared in a header file?
How can I handle floating-point exceptions gracefully?
What is %g in c?
What is the use of header?
Explain About fork()?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
what will be the output for the following main() { printf("hi" "hello"); }
Explain what is the difference between the expression '++a' and 'a++'?
What is const volatile variable in c?
What is the difference between void main and main in c?
What are local static variables?