Even or odd number
A worked example to adapt. Rename steps, add branches and owners to match how your team actually works.
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 --> ePaste 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
- Start. Begin with the start oval.
- Input N. Read the number to test. Use a parallelogram for input.
- Calculate the remainder. R = N mod 2. This is a process box because it is a calculation.
- Decision. Is R equal to 0?
- Output. Yes: print that N is even. No: print that N is odd.
- End. Both outputs connect to one end oval.
How to make it in flow-chart.io
- 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.
- 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.
- 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.
- 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
- Python: n = int(input()); print("even" if n % 2 == 0 else "odd").
- C or Java: if (n % 2 == 0) print even; else print odd.
- JavaScript: console.log(n % 2 === 0 ? "even" : "odd").
- Loop version for numbers 1 to 10: set i = 1; while i ≤ 10, test i mod 2, print the result, add 1 to i. Draw the loop as an arrow back to the test.
- Test with 0 (even), 7 (odd) and -4 (even) before you hand it in.
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.