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


Please Help Members By Posting Answers For Below Questions

How can I trap or ignore keyboard interrupts like control-c?

612


What are the 5 types of inheritance in c ++?

574


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

754


List some of the dynamic data structures in C?

780


Explain how can you restore a redirected standard stream?

585






Should a function contain a return statement if it does not return a value?

590


Why c is a procedural language?

578


What is an endless loop?

796


What does void main return?

597


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

644


difference between Low, Middle, High Level languages in c ?

1626


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

653


What are the different types of errors?

635


What is the best style for code layout in c?

628


Define macros.

777