Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

find a number whether it is even or odd without using any
control structures and relational operators?

Answer Posted / ramya

A number anded with the lower number that is n & (n - 1) =
0 then it is even if it is anything else it is odd

odd_even (int n)

{
if (!(n & (n -1))
number is odd
else
number is even

}

Is This Answer Correct ?    9 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor

1107


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3985


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

1075


What are the scope of static variables?

1198


What is the translation phases used in c language?

1124


I heard that you have to include stdio.h before calling printf. Why?

1077


How are variables declared in c?

1110


What is the difference between c &c++?

1166


What is a program flowchart?

1215


What does %d do in c?

969


What is the difference between malloc calloc and realloc in c?

1155


Explain what is output redirection?

1203


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1130


What is spaghetti programming?

1145


What is the use of #define preprocessor in c?

1081