TO CHECK ith BIT IS SET OR NOT OF A NUMBER code example
Example: TO CHECK ith BIT IS SET OR NOT OF A NUMBER
x = num & (1 << (i-1));
if(x) cout<<"set"<<endl;
else cout<<"not set"<<endl;
x = num & (1 << (i-1));
if(x) cout<<"set"<<endl;
else cout<<"not set"<<endl;