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

Which are low level languages?

1059


Why void main is used in c?

1028


How many levels of indirection in pointers can you have in a single declaration?

1048


write a program in c language to print your bio-data on the screen by using functions.

6754


Explain how can you determine the size of an allocated portion of memory?

1065


Describe the difference between = and == symbols in c programming?

1324


What is a pointer value and address in c?

1083


What are global variables?

1140


What is a shell structure examples?

1053


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3049


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

1036


What is the difference between formatted&unformatted i/o functions?

1030


Explain what header files do I need in order to define the standard library functions I use?

1132


What are the Advantages of using macro

1136


What is a stream in c programming?

1106