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 do I get a null pointer in my programs?

620


What are void pointers in c?

574


Compare interpreters and compilers.

639


What is use of integral promotions in c?

666


Explain what are the different file extensions involved when programming in c?

633






hi send me sample aptitude papers of cts?

1654


What are reserved words with a programming language?

604


What is echo in c programming?

557


Where local variables are stored in c?

556


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

912


What is difference between scanf and gets?

612


What is difference between Structure and Unions?

640


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

2725


Can we declare function inside main?

569


What are the types of type specifiers?

623