• + 0 comments

    ‵‵‵c 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++) {
            int a = i & j;
            int o = i | j;
            int x = i ^ j;
    
            if (a < k && a > maxAnd) {
                maxAnd = a;
            }
            if (o < k && o > maxOr) {
                maxOr = o;
            }
            if (x < k && x > maxXor) {
                maxXor = x;
            }
        }
        ‵‵‵
    }
    printf("%d\n%d\n%d\n", maxAnd, maxOr, maxXor);
    

    }