If y=2 z=3 and x=y&z then x=? (Use of Bitwise Operator )



There are 3 main Bitwise Operator
 & The bitwise AND operator
| The bitwise OR operator
^                                                          The bitwise exclusive OR (XOR) operator 

Using AND Bitwise Operators:

x= y&z
Here y and z are operands.
If y=2 and z=3
Decimal Results
  Expressions        Binary           Decimal       Binary
         2 & 3     0010 & 0011               2     0010
the expression with two binary operands, 0010 & 0011, returns 0010
so the Ans is x= 2.

Program:

void main( )

{
int x,y,z;
clrscr();
y=2;
z=3;
x= y&z;
printf("%d",x);
getch();
}
Output:2                                 









0 comments:

DynamicOxygen.com - Enjoy High eCPM Rates!

Members

 

Copyright © 2008-2011 InFoMiXo , Owner:Pratyush Maurya. All rights reserved.


Top | MS DINESH PAGE(POETRIES AND SHARIYA) | About Us | Contact Us



This site is best viewed with Internet Explorer 6.0 or higher, or Firefox 2.0 or higher, at a minimum screen resolution of 1024x768.