<jupyter_start><jupyter_text>Full Adder[Back](https://mark1626.github.io/knowledge/)<jupyter_code>import numpy as np
from qiskit import QuantumCircuit<jupyter_output><empty_output><jupyter_text>Circuit<jupyter_code>c = QuantumCircuit(5, 2)

# A = 1, B = 0, Cin = 1
c.x([0, 2])

c.barrier()
c.ccx(0, 1, 4)
c.cx(0, 3)
c.cx(1, 3)
c.ccx(2, 3, 4)
c.cx(2, 3)
c.barrier()

c.measure([3, 4], [0, 1])

c.draw("mpl")<jupyter_output><empty_output><jupyter_text>Simulation<jupyter_code>from qiskit import transpile
from qiskit.providers.aer import QasmSimulator
from qiskit.visualization import plot_histogram

backend = QasmSimulator()
compilation = transpile(c, backend)

job = backend.run(compilation, shots = 1024)

result = job.result()
counts = result.get_counts(compilation)
plot_histogram(counts)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14841849148418493, 'fraction_numerical': 0.037712895377128956, 'mean_word_length': 6.990291262135922, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '53553', 'license': 'CC0-1.0', 'n_tokens_mistral': 377, 'n_tokens_neox': 345, 'n_words': 63, 'path': 'quantum/Full Adder.ipynb', 'repo_name': 'Mark1626/knowledge', 'size': '822'}