# How to remove ancilla bits from results?

I have a circuit with 2 ancilla bits. I have only asked that the circuit measure the 4 other qubits, but the results keep including the ancilla bits. How to remove the ancilla bits from the results?

The purpose of the circuit is to calculate $$q_0 \,\text{AND}\, q_1 \,\text{AND} q_2$$. To do so, firstly $$q_0 \,\text{AND}\, q_1$$ is calculated and result is stored to ancilla $$q_3$$. After that final result is obtained by $$q_2 \,\text{AND}\, q_3$$ and stored to $$q_4$$. Finnaly, inverse operation (note that inverse gate to Toffoli is again Toffoli) is applied. As a result, state of ancilla $$q_3$$ is returned back to $$|0\rangle$$. This value is returned during measurement. If you do not want to include ancilla to measurement, simply do not put the measurement on qubit $$q_3$$.