# Quantum circuit not giving right results

I am trying to write a quantum circuit that implements swapping. The initial state is $$\phi^+_{12}\phi^+_{34},$$ where particles $$(1,4)$$ belong to $$A$$ and $$(2,3)$$, belong to $$B$$. After A's measurement in Bell basis we have $$\phi^+_{14}\phi^+_{23}+\phi^-_{14}\phi^-_{23}+\psi^+_{14}\psi^+_{23}+\psi^-_{14}\psi^-_{23}.$$ Which means that $$(2,3)$$ become entangled after the measurement of $$(1,4)$$.I got the results correct, the problem was the measurement that was stored in the classical register, (the order in which it is measured matters) my output was as can be seen the 5th and 6th qubit are entangled. Basically i measured the 1st qubit on register 5 and the 4th qubit on register 6. However there is a problem when i run it on a IBM's melbourne hardware, it transpiles, but doesn't run. I guess the problem is with the conditional 'if' statements i have used after i have measured the qubits $$2,6,3,5$$. For instance when i get value of $$c=2,7,8,13$$ on the classical register i do a $$X$$ gate on the first qubit. But how do i do this without the if statement.

## 1 Answer

While designing your circuit are you sure 6 Qubits were really required for X gate . As i am observing in your above plot there are two possible probabilities hopefully that might be right ,

I would suggest you to start designing the above circuit with 2 Qubits and observe the outcome.