You are viewing a single comment's thread. Return to all comments →
void calculate_the_maximum(int n, int k) { //Write your code here. int maxAND=0, maxOR=0, maxXOR=0; for(int i=1; i<=n;i++) { for(int j=i+1; j<=n; j++) { maxAND = ((maxAND < (i&j)) && (i&j) } } printf("%d\n%d\n%d\n", maxAND,maxOR,maxXOR); }
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 →
void calculate_the_maximum(int n, int k) { //Write your code here. int maxAND=0, maxOR=0, maxXOR=0; for(int i=1; i<=n;i++) { for(int j=i+1; j<=n; j++) { maxAND = ((maxAND < (i&j)) && (i&j) } }
printf("%d\n%d\n%d\n", maxAND,maxOR,maxXOR); }