check this method
int clear bit(int n,int i) { int mask=(1<<i); int ans=N^i; return ans }
this method would work