Hey man, you need to do homeworks yourself. But given that your mentioned problem is interesting NP problem,- i'll give you small pseudocode snippet:

#define OP_NOT 1
#define OP_AND 2
#define OP_OR 3
int bool_formula[6] = {OP_NOT,0,OP_AND,0,OP_OR,0};
int bit_pattern = -1;
char x1,x2,x3;
int is_formula_satisfiable = 0;
WHILE (bit_pattern <= 7 /*111 in binary*/) {
++bit_pattern;
x1 = extract_first_bit(bit_pattern);
x2 = extract_second_bit(bit_pattern);
x3 = extract_third_bit(bit_pattern);
substitute_x_variables_to(bool_formula);
// such as bool formula will become =>
// {OP_NOT,x1,OP_AND,x2,OP_OR,x3};
is_formula_satisfiable = Evaluate_bool_formula(bool_formula);
if (is_formula_satisfiable) {
// this bool formula is satisfiable and there is no need to
// analyze other combinations of x1,x2,x3
break;
}
}
// if after while loop variable is_formula_satisfiable == 0, then
// this bool formula is un-satisfiable or in other words -> is in-distinguishable
// from FALSE constant

This is a program that ask input from the user about the characteristics of a gemstone then prints to the screen. Things like color, price and name. I have written ...