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


Please Help Members By Posting Answers For Below Questions

What are operators in c?

583


What is derived datatype in c?

635


How can I prevent another program from modifying part of a file that I am modifying?

614


Why ca not I do something like this?

587


Can static variables be declared in a header file?

618






How can I handle floating-point exceptions gracefully?

636


What is %g in c?

618


What is the use of header?

623


Explain About fork()?

647


List the difference between a 'copy constructor' and a 'assignment operator' in C?

637


what will be the output for the following main() { printf("hi" "hello"); }

9332


Explain what is the difference between the expression '++a' and 'a++'?

627


What is const volatile variable in c?

577


What is the difference between void main and main in c?

626


What are local static variables?

619