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
Can the size of an array be declared at runtime?
What are 'near' and 'far' pointers?
What is the maximum length of an identifier?
Is printf a keyword?
When a c file is executed there are many files that are automatically opened what are they files?
What is the use of typedef in c?
What is the stack in c?
Explain what happens if you free a pointer twice?
what is the function of pragma directive in c?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
Write a program to print “hello world” without using semicolon?
Are there any problems with performing mathematical operations on different variable types?
How can I sort more data than will fit in memory?
Can you please explain the difference between exit() and _exit() function?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.