#include void main() { //boolean binary operation number: 0000, 0001,... 1111 int op; //true table of operation: x # y = tt[x][y] int tt[2][2]; int x, y, z; for(op = 0; op < 16; op++) { tt[0][0] = op & 1; tt[0][1] = (op >> 1) & 1; tt[1][0] = (op >> 2) & 1; tt[1][1] = (op >> 3) & 1; printf("Operation:\nx y x # y\n0 0 %d\n0 1 %d\n1 0 %d\n1 1 %d\n", tt[0][0], tt[0][1], tt[1][0], tt[1][1]); //check assotiativity bool assty = true; for (x = 0; x <= 1; x++) for (y = 0; y <= 1; y++) for (z = 0; z <= 1; z++) { if (tt[tt[x][y]][z] != tt[x][tt[y][z]]) { assty = false; break; } } printf("Assotiativity: %s\n\n", assty ? "Yes" : "No"); } }