Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Tools › Computer Science

Truth table generator

Every row of a logic expression with AND, OR, NOT and XOR.

5 of 8 rows are true

  1. A B C │ out
  2. 0 0 0 │ 0
  3. 0 0 1 │ 1
  4. 0 1 0 │ 0
  5. 0 1 1 │ 1
  6. 1 0 0 │ 1
  7. 1 0 1 │ 1
  8. 1 1 0 │ 0
  9. 1 1 1 │ 1

How it works

A truth table lists every combination of inputs and the output for each. With n inputs there are 2ⁿ rows.

Write AND as AND, & or ·; OR as OR, | or +; NOT as NOT, ! or ¬; XOR as XOR or ^.

Worked example

With Expression = A AND NOT B OR C:

  1. A B C │ out
  2. 0 0 0 │ 0
  3. 0 0 1 │ 1
  4. 0 1 0 │ 0
  5. 0 1 1 │ 1
  6. 1 0 0 │ 1
  7. 1 0 1 │ 1
  8. 1 1 0 │ 0
  9. 1 1 1 │ 1

Answer: 5 of 8 rows are true

Questions

Which goes first, AND or OR?
NOT first, then AND, then XOR, then OR, just like × before + in arithmetic. Use brackets to be sure.

Learn the method properly

The chapter behind this tool, with animations, an experiment and an AI tutor who checks each step you write.

Open the chapter

More computer science tools

  • Binary, decimal and hex converter
  • Password strength checker