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 && i <= n; j++){ int and = j&i; int or = j|i; int xor = j^i; if(and>maxAND && andmaxOR && ormaxXOR && xor
}
printf("%d\n%d\n%d", 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 →
int maxAND = 0, maxOR = 0, maxXOR = 0; for(int i= 1 ; i <= n; i++){ for(int j = i+ 1 ; j <= n && i <= n; j++){ int and = j&i; int or = j|i; int xor = j^i; if(and>maxAND && andmaxOR && ormaxXOR && xor
}
}