```
unsigned int Solution::reverse(unsigned int A) {
if(A == 0) return 0;
unsigned long int sum = 0;
int rem;
for(int i=0; i<32; i++){
rem = A%2;
A = A/2;
if(rem == 1){
sum = sum + pow(2, 31-i);
}
}
return sum;
}
```