To find whether a number is even or odd without using any
conditional operator??
Answer Posted / mohd adnan
/* By Mohd Adnan MCA(2007-10) IMS Ghaziabad */
/* by using bit wise operator*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("Enter any number:");
scanf("%d",%num);
(num&1)&&printf("Odd Number");
((num&1)==0)&&printf("Even Number");
getch();
}
Is This Answer Correct ? | 37 Yes | 15 No |
Post New Answer View All Answers
How do I get a null pointer in my programs?
What are void pointers in c?
Compare interpreters and compilers.
What is use of integral promotions in c?
Explain what are the different file extensions involved when programming in c?
hi send me sample aptitude papers of cts?
What are reserved words with a programming language?
What is echo in c programming?
Where local variables are stored in c?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
What is difference between scanf and gets?
What is difference between Structure and Unions?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
Can we declare function inside main?
What are the types of type specifiers?