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?

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / guest

#include<stdio.h>
#include<conio.h>
void main()
{
int x;
if(x%2==0)
printf("even");
else
printf("odd");
getch();
}

Is This Answer Correct ?    4 Yes 25 No

Post New Answer

More C Interview Questions

write a program fibonacci series and palindrome program in c

0 Answers   Aditi Placement Service,


Differentiate between new and malloc(), delete and free() ?

0 Answers   iNautix,


What is function and its example?

0 Answers  


Explain output of printf("Hello World"-'A'+'B'); ?

0 Answers  


What is clrscr in c?

0 Answers  


Explain a pre-processor and its advantages.

0 Answers  


In header files whether functions are declared or defined?

1 Answers   TCS,


How do I create a directory? How do I remove a directory (and its contents)?

0 Answers  


difference between spiral and waterfall model

1 Answers  


How many levels deep can include files be nested?

0 Answers  


write a c program to find the sum of five entered numbers using an array named number

0 Answers   TATA,


what is diff b/w huge & far & near pointer??

1 Answers   HCL,


Categories