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

What are reserved words with a programming language?

1133


What is the purpose of main() function?

1243


What are valid operations on pointers?

1195


What oops means?

999


What is actual argument?

1060


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

998


What are variables c?

1051


write a program for the normal snake games find in most of the mobiles.

2253


Do you know null pointer?

1021


What is static identifier?

1220


write a program to display all prime numbers

1960


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

2123


Why does the call char scanf work?

1202


What is volatile variable in c?

1089


What is the advantage of a random access file?

1196