How abt this..?

for(i=0;i<x;i++)
  {
    res=no&1U;
    no=no>>1;
    if(res==1)
      no=no|32768U;
    else
      no=no|0U;
  }
  printf("\nFinal value %u",no);


On Oct 12, 8:11 pm, Raghavendra Sharma <raghavendra.vel...@gmail.com>
wrote:
> temp =  (0xFFFF >> (32 - x)) & n;
> n  =  (n  >> x) | ( temp << (32 -x));
>
> On Mon, Oct 12, 2009 at 5:32 PM, ankur aggarwal 
> <ankur.mast....@gmail.com>wrote:
>
>
>
> > *You are given a integer and you want to rotate the bits of the number by
> > a value x. Consider the right rotation by x means the least significant x
> > bits should go out from left and take the position of most significant x
> > bits.*- Hide quoted text -
>
> - Show quoted text -

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to