# Bernstein-Vazirani algorithm in IBM Q Experience [closed]

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?

• What do you mean by answer? Do you mean a measurement? Please add a figure of your circuit or QASM code to better understand what you are looking for. Thanks. – Martin Vesely Nov 26 '19 at 12:14

I think this should help:

circuit.measure([0,1,2,3], [0,1,2,3,4,5])


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.