You are viewing a single comment's thread. Return to all comments →
int i, j,AND,OR,XOR; int And_max = 0 ,Or_max = 0, Xor_max = 0 ; for(i = 1 ; i <n+1;i++) { for(j = i+1 ;j < n+1 ;j++) { AND = i&j; OR = i|j; XOR = i^j; if(AND != 0 ){ if((AND < k)&&(AND > And_max)){ And_max = AND; } } if(OR != 0 ){ if((OR < k)&&(OR > Or_max)){ Or_max = OR; } } if(XOR != 0){ if((XOR < k)&&(XOR > Xor_max)){ Xor_max = XOR; } } } } printf("%d\n%d\n%d",And_max,Or_max,Xor_max);
Seems like cookies are disabled on this browser, please enable them to open this website
Bitwise Operators
You are viewing a single comment's thread. Return to all comments →