# Bit Manipulation (level- 2)

1) Gray to binary

```cpp
int grayToBinary(int n) {
        // Your code here
        int res =n;
        while(n>0){
            n= n>>1;
            res= res^n;
        }
        return res;
        
    }
```

2) Binary to gray

```cpp
int greyConverter(int n) {

        // Your code here
        return n ^ (n>>1);
    }
```
