This is a qiskit algoritham to subtract a decimal number from another number.
libraries needed :-
- python3.
- qiskit .
- qiskit.visualization.
Two do subtraction of bits with carry the following code is used:-
- qc.cx(i,i+1)
- qc.cx(i+2,i+4)
- qc.ccx(i,i+1,i+2)
- qc.cx(i+2,i+4)
The number of bit of the biggest number has to be given as input.
The total number of bits used 2*n+1