not 100% sure if this is what you are asking for but here it goes.

you have a number 11110000 (binary) and you want 00001111 (binary)?

you want to use the xor operator ^

value = 0xf0; //11110000 binary
printf("before %d\n");
value ^= 0xff; //11111111 binary
printf("after%d\n");


output:
before 240
after 15

240 in binary is 11110000
15 in binary is 00001111
<http://wiki.answers.com/Q/How_do_you_reverse_a_number_using_bitwise_operator#ixzz1Uk5fUjai>


On Thu, Aug 11, 2011 at 10:43 PM, Rajeshwar Patra
<rajeshwarpa...@gmail.com>wrote:

> how can we reverse a number using bitwise operators?
>
> --
> *Rajeshwar Patra,*
> *MCA final year,*
> *Nit Durgapur*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
*Narayanan S,*
B.E., C.S.E., (final year),
College Of Engineering Guindy,
Anna University,
Chennai-25.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to