Flowchart examples · Programming and algorithms

Flowchart to check if a number is even or odd

Read a number, divide by 2, and test the remainder: 0 means even, anything else means odd. With pseudocode, code and a loop version.

Use this template Describe your own version

Even or odd number

Even or odd numberYesNoStartRead NR = N mod 2R = 0?Print N is evenPrint N is oddEnd
Use this template →Opens this exact diagram in the editor, every box and arrow editable. Free account; no AI credits used.

A worked example to adapt. Rename steps, add branches and owners to match how your team actually works.

Edit the steps to match your process. The free preview (no sign-up) drafts up to 8 main steps; add branches and the remaining steps in the editor.
Mermaid source for this diagram
flowchart TD
  s(["Start"])
  in[/"Read N"/]
  r["R = N mod 2"]
  d1{"R = 0?"}
  ev[/"Print N is even"/]
  od[/"Print N is odd"/]
  e(["End"])
  s --> in
  in --> r
  r --> d1
  d1 -->|Yes| ev
  d1 -->|No| od
  ev --> e
  od --> e

Paste into any Markdown tool that renders Mermaid, such as GitHub.

About this flowchart to check even or odd number

Checking whether a number is even or odd is usually the first decision students draw in a flowchart. The rule is simple: an even number divides by 2 with no remainder, an odd number leaves a remainder of 1.

In a flowchart the remainder is calculated in a process box with the modulo operator, written mod in pseudocode and % in most programming languages. A single diamond then tests whether the remainder is zero. The Yes exit prints that the number is even and the No exit prints that it is odd; both lead to the same end oval.

Negative numbers need one note. In some languages, such as C and Java, -3 % 2 gives -1 rather than 1. Testing "remainder equals 0" for even, as this chart does, works for negative numbers in every language; testing "remainder equals 1" for odd does not.

Step by step

  1. Start. Begin with the start oval.
  2. Input N. Read the number to test. Use a parallelogram for input.
  3. Calculate the remainder. R = N mod 2. This is a process box because it is a calculation.
  4. Decision. Is R equal to 0?
  5. Output. Yes: print that N is even. No: print that N is odd.
  6. End. Both outputs connect to one end oval.

How to make it in flow-chart.io

  1. Start from the example. Press "Use this template" to open this exact even-or-odd flowchart in the editor, or edit the text in the generator box and press Generate for a free preview without signing up.
  2. Match your program. Rename the input, process and output boxes so they use the same variable names as your code. Keep one action per box.
  3. Check every branch. Trace each diamond with a test value for the Yes exit and one for the No exit, and make sure both reach the end oval.
  4. Share or export. Share a read-only view link with a classmate or reviewer. Downloads as PNG, SVG or PDF are part of Flow Pro (see pricing).

Tips

Frequently asked questions

What is the formula to check even or odd?
Divide the number by 2 and look at the remainder. If N mod 2 equals 0 the number is even; otherwise it is odd.
Is 0 even or odd?
Even. 0 divided by 2 is 0 with remainder 0, so the flowchart prints even.
Which symbol is used for the remainder calculation?
A rectangle (process). The reading of N and the printed result use parallelograms (input/output), and the test uses a diamond (decision).
Can I do it without the modulo operator?
Yes: compute N - 2 × (N div 2) using integer division, or check the last binary digit (N and 1). The flowchart shape stays the same; only the process box changes.
How do I edit this flowchart?
Press Use this template to open it in the editor with a free account, or type your own steps into the text to flowchart tool to see a diagram instantly.

Related

Flowchart to find the largest of three numbersPrime number flowchartLeap year flowchartFactorial flowchartStudent grade flowchartFlowchart symbolsHow to make a flowchartText to flowchart toolAll flowchart examples

Build it from your own words

Describe your process and get an editable diagram. Free to build and edit; Flow Pro adds downloads and unlimited projects.

Start free See pricing