Flowchart Updated 12/2/2026

Even or Odd Flowchart

Flowchart to check even or odd: read n, find the remainder r = n % 2, and ask whether r == 0. With a trace for n = 17, pseudocode, tested Python, C and Java code, and the negative number trap.

even or oddflowchartif-elsemodulusprogramming
7 nodes 7 connections

Study guide

Even or Odd FlowchartStartRead nSet r = n % 2r == 0?Print "n is even"Print "n is odd"EndYesNo
Even or Odd Flowchart. Source: https://www.chartcraft.dev/examples/even-or-odd-flowchart

What the even or odd check flowchart shows

A number is even when dividing it by 2 leaves nothing over, and odd when 1 is left over. A flowchart to check even or odd computes that remainder with the % (modulus) operator and asks one question: is it 0?

It is the smallest useful decision flowchart there is, which makes it the perfect first diagram to get exactly right.

Even or odd check flowchart, step by step

  1. terminator StartOne Start terminator opens the flowchart.
  2. input/output Read nThe program reads a whole number into n. Input belongs in a parallelogram.
  3. process Set r = n % 2n % 2 is the remainder when n is divided by 2. For 17 that is 1, because 17 = 2 x 8 + 1. Storing it in r makes the next diamond easy to read.
  4. decision r == 0?The only decision. Test r == 0, not r == 1: for negative numbers some languages give a remainder of -1, but an even number always gives exactly 0.
  5. input/output Print "n is even"Reached on Yes: nothing was left over.
  6. input/output Print "n is odd"Reached on No: something was left over, so the number is odd.
  7. terminator EndBoth outputs flow into the same End terminator.

Dry run: trace table for n = 17

Follow the flowchart with n = 17, one row per box.

StepBoxWhat happens
1Read nn = 17
2Set r = n % 217 = 2 x 8 + 1, so r = 1
3r == 0?1 == 0 is false, so take No
4Print17 is odd

Try n = 24 yourself: r = 0, the answer is Yes, and the output is 24 is even.

Even or odd check pseudocode

Pseudocode
READ n
r = n MOD 2
IF r = 0 THEN
    PRINT n, "is even"
ELSE
    PRINT n, "is odd"
ENDIF

Even or odd check in Python, C and Java

Python
n = int(input())

r = n % 2
if r == 0:
    print(n, "is even")
else:
    print(n, "is odd")
C
#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);

    int r = n % 2;   /* -1 for negative odd numbers in C */
    if (r == 0) {
        printf("%d is even\n", n);
    } else {
        printf("%d is odd\n", n);
    }
    return 0;
}
Java
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();

        int r = n % 2;   // -1 for negative odd numbers in Java
        if (r == 0) {
            System.out.println(n + " is even");
        } else {
            System.out.println(n + " is odd");
        }
    }
}
Input typed at the keyboard
17
Output of all three programs
17 is odd

All three programs were compiled and run with the input 17 before this page was published, and they print exactly the output shown. In Python -7 % 2 is 1, while in C and Java it is -1. Testing r == 0 gives the right answer in all three.

Mistakes examiners see most

  • Testing r == 1 for odd numbers. In C and Java -7 % 2 is -1, so a flowchart that asks r == 1? calls -7 even. Ask r == 0? instead.
  • Dividing instead of taking the remainder. n / 2 is the quotient. 17 / 2 is 8 in C and Java, and 8.5 in Python. Neither tells you the parity directly; the remainder does.
  • Writing = instead of == in the diamond. A diamond asks a question, so it compares with ==. r = 0 is an assignment, and in C it even compiles and gives the wrong answer.
  • Two End boxes or unlabelled arrows. Keep one End and label both diamond exits Yes and No, as in the if-else statement flowchart.

Practice questions with worked answers

Q1 What does the flowchart print for n = 0 and for n = -6?

0 % 2 is 0, so 0 is even. Zero is an even number.

-6 % 2 is 0 in Python, C and Java alike, so -6 is even. Only odd negatives give a different remainder (1 in Python, -1 in C and Java).

Q2 Rewrite the decision without the % operator, using the fact that integer division drops the remainder.

Compute h = n / 2 with whole number division, then ask h * 2 == n?. For 17, h = 8 and 8 x 2 = 16, which is not 17, so 17 is odd.

Pseudocode
READ n
h = n DIV 2
IF h * 2 = n THEN
    PRINT n, "is even"
ELSE
    PRINT n, "is odd"
ENDIF
Q3 Extend the flowchart to count how many of 10 numbers are even. What does it need?

A counter evens = 0 and a loop that runs 10 times: read n, ask n % 2 == 0?, and on Yes set evens = evens + 1. After the loop, print evens.

The parity diamond sits inside the loop body, the same pattern as the for loop flowchart.

Flowchart symbols used and why

SymbolShape to draw on paperWhere it appears hereWhy
TerminatorRounded boxStart and EndOne entry and one exit.
Input/outputParallelogramRead n and both Print boxesThey move data in or out of the program.
ProcessRectangleSet r = n % 2A calculation that stores a value and has one exit.
DecisionDiamondr == 0?A yes-or-no question with two labelled exits.
Flow lineArrowEvery arrowArrows give the order of the steps.

In the interactive diagram every step is a labelled card: the small word above each step names its kind (process, decision or data). When you draw this flowchart by hand, use the standard shapes in the table. The full list is on the flowchart symbols page.

Make your own version

Each link opens the editor with a prompt already filled in. Change the wording, then generate your own flowchart.

How can I use this flowchart?

Download the Even or Odd Flowchart as a PNG or SVG, or open it in the studio to edit your own copy. To draw a similar flowchart from a description, use the flowchart generator; for notation and a step-by-step walkthrough, read how to make a flowchart; and browse more flowchart examples for related layouts.

Try the studio with your own description.

Type any system, process, or schema in plain English. ChartCraft will draw it in seconds.