Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  odd
Language: C/C++
Code:
#include<stdio.h>
unsigned int reverseBits(unsigned int num)
{
    unsigned int  NO_OF_BITS = sizeof(num) * 8;
    unsigned int reverse_num = 0;
    int i;
    for (i = 0; i < NO_OF_BITS; i++)
    {
        if((num & (1 << i)))
           reverse_num |= 1 << ((NO_OF_BITS - 1) - i); 
   }
    return reverse_num;
}
 
int main()
{
    unsigned int x = 10000;
    printf("output::%d", reverseBits(x));
   
}
          
          
          
Comments: