I have composed the gate with IBM Q Experience, but I do not know how to set the answer.
Please tell me how to set it?
I think this should help:
for 4 qubits.
The secret number = '1001' for the circuit below:
NOTE the xor gates "cx" in qbit 0 and 3 are because it is 1 on the first and last bit of the secret number.
And after that simulate (to get the answer):
I hope I've helped.