**Problem:**
**In this question I tried to solve a bitwise operator problem. Giving two number as input**
**Input will be two number. Here is some input:**

```
n = 3
k = 3

```

**Then I need to construct "a" and "b" in some way(for instance when "a = 1" then b will be one past a to <= n. The results of the comparisons are below:**

```
a b   and or xor
1 2   0   3  3
1 3   1   3  2
2 3   2   3  1

```

**Here is my code:**

```
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
//Complete the following function.

void calculate_the_maximum(int n, int k) 
{
    // Two dimentional array for storing the value of and or xor
    int rowOfArray = 3;

    int sets[rowOfArray][k];

    //For loop for a
    for (int i = 0; i < k; i++)
    {
        int a = i + 1;
        //For loop for b
        for (int j = a; j < n; j++)
        {
            int b = j;
            b++;
            printf("{%i, %i}\n", a, b);
            //Storing and operation result to the array
            sets[0][j - 1] = a&b;
            printf("And: %i\n", sets[0][j - 1]);
            //Storing or operation result to the array
            sets[1][j] = a|b;
            printf("Or: %i\n", sets[1][j]);
            //Storing xor opertaion result to the array
            sets[2][j + 1] = a^b;
            printf("Xor: %i\n", sets[2][j + 1]);
        } 

    }

    //Find the biggest number in array 
    for (int i = 0; i < rowOfArray; i++)
    {
        int big;

        for (int j = 0; j < k; j++)
        {
            big = 0;
            printf("Big1: %i\n", big);

            if (big < sets[i][j])
            {
                big = sets[i][j];

                printf("Big2: %i\n", big);
            }
        }

        printf("big3: %i\n", big);
        if (big < k)
        {
            printf("%i\n", big);
        }
        else
        {
            printf("%i\n", 0);
        }
    }
}

int main() {
    int n, k;

    scanf("%d %d", &n, &k);
    calculate_the_maximum(n, k);

    return 0;
}

```

I used too many printf function to show that what have I done wrong. I stored the value as I expected but later in the for loop when I tried to print the specific position integer I didn't get the correct result even sometimes I got bigger and negative number too.

**Here is the output:**

```
 3 3
{1, 2}
And: 0
Or: 3
Xor: 3
{1, 3}
And: 1
Or: 3
Xor: 2
{2, 3}
And: 2
Or: 3
Xor: 1
Big1: 0
Big1: 0
Big2: 2
Big1: 0
Big2: 120329728
big3: 120329728
0
Big1: 0
Big2: 1986993953
Big1: 0
Big2: 3
Big1: 0
Big2: 3
big3: 3
0
Big1: 0
Big1: 0
Big2: 32765
Big1: 0
Big2: 3
big3: 3
0

```