Lesson Progress
0%
Lesson  ·  Flowchart Symbols

Flowcharts — Drawing Logic Before Writing Code

Before a single line of C is typed, a flowchart maps out exactly what a program should do — using just a handful of standard shapes. This lesson explains every symbol, then walks through 4 complete flowcharts paired with their real C code.

Symbol legend
Even or Odd
Largest of Three
Sum of N Numbers
Prime Check
📖

The Standard Flowchart Symbols

Every flowchart is built from just 5 shapes. Each shape has one fixed job — the shape itself tells you what kind of step you're looking at, before you even read the text inside it.
Start / End

Terminal (Oval)

Marks where the program begins or ends. Every flowchart has exactly one Start and at least one End.

sum = a + b

Process (Rectangle)

A calculation, assignment, or any action taken — like updating a variable.

a > b ?

Decision (Diamond)

A yes/no question. Exactly 2 arrows leave a decision — one for each possible answer.

Input n

Input / Output (Parallelogram)

Reading a value in (scanf) or displaying a value out (printf).

flow direction

Flow Line (Arrow)

Shows the order steps happen in — always follow the direction of the arrowhead.

A

Connector (Circle)

Links two points in a large flowchart without drawing a long messy line across the page.

SymbolC equivalent
Terminalmain() { ... } start and return 0; end
ProcessAny assignment statement, e.g. sum = sum + i;
Decisionif, while, for conditions
Input/Outputscanf() / printf()
💡 Read top to bottom, following the arrows. A flowchart is a map, not a decoration — every path from Start to End represents one possible way the program can actually run.
flowchart 1
1

Check Even or Odd

The simplest possible branching flowchart — one decision, two possible outputs.
Start Input n n % 2 == 0 ? (is n even?) Yes No Print "Even" Print "Odd" End
even_odd.c
even_odd.c
C
#include <stdio.h>

int main() {
    int n;
    printf("Enter n: ");
    scanf("%d", &n);

    if (n % 2 == 0)
        printf("Even\n");
    else
        printf("Odd\n");

    return 0;
}
terminal
output
Enter n: 17
Odd
flowchart 2
2

Find the Largest of Three Numbers

A "staircase" of decisions — each No leads to another question, until one final answer is reached.
Start Input a, b, c a > b && a > c ? Yes largest = a No b > c ? Yes largest = b No largest = c Print largest End
largest_of_three.c
largest_of_three.c
C
#include <stdio.h>

int main() {
    int a, b, c, largest;
    printf("Enter a, b, c: ");
    scanf("%d %d %d", &a, &b, &c);

    if (a > b && a > c)
        largest = a;
    else if (b > c)
        largest = b;
    else
        largest = c;

    printf("Largest: %d\n", largest);
    return 0;
}
terminal
output
Enter a, b, c: 12 45 30
Largest: 45
flowchart 3
3

Sum of First N Natural Numbers

The first loop flowchart — notice the arrow that curves back up, re-checking the condition every time.
Start Input n sum=0, i=1 i <= n ? Yes sum = sum+i i = i + 1 loop back No Print sum End
sum_of_n.c
sum_of_n.c
C
#include <stdio.h>

int main() {
    int n, sum = 0;
    printf("Enter n: ");
    scanf("%d", &n);

    for (int i = 1; i <= n; i++) {
        sum = sum + i;
    }

    printf("Sum = %d\n", sum);
    return 0;
}
terminal
output
Enter n: 5
Sum = 15
💡 The "loop back" arrow IS the for-loop. Every time execution reaches that path, it's exactly equivalent to for re-checking its condition and running the update step (i++) before looping again.
flowchart 4
4

Check If a Number Is Prime

Combines a loop AND a final decision — this is the most complete flowchart in the lesson, tying together everything above.
Start Input n i=2, flag=1 i < n ? Yes n % i == 0? Yes flag = 0 i = i + 1 No loop back No (loop ended) flag == 1 ? Yes Print "Prime" No Print "Not Prime" End
prime_check.c
prime_check.c
C
#include <stdio.h>

int main() {
    int n, i, flag = 1;
    printf("Enter n: ");
    scanf("%d", &n);

    for (i = 2; i < n; i++) {
        if (n % i == 0) {
            flag = 0;   // found a divisor -> not prime
        }
    }

    if (flag == 1)
        printf("Prime\n");
    else
        printf("Not Prime\n");

    return 0;
}
terminal
output
Enter n: 23
Prime
💡 Every diamond in this flowchart is one if/for condition in the code. The "i < n?" diamond is the for-loop's condition; "n % i == 0?" is the inner if; "flag == 1?" is the final if-else. Three diamonds, three conditions — nothing more.
quiz
Q

Quick Quiz

Question 1 of 5

Which shape represents a yes/no decision?

Question 2 of 5

How many arrows normally leave a decision (diamond) symbol?

Question 3 of 5

Which symbol represents scanf() or printf()?

Question 4 of 5

In the Sum of N Numbers flowchart, what does the "loop back" arrow represent in the C code?

Question 5 of 5

In the Prime Check flowchart, how many diamonds (decisions) are there, and why?

Lesson Checklist

  • I can name all 5 standard flowchart symbols and their jobs
  • I can trace the Even/Odd flowchart to its matching C code
  • I can trace the staircase decision pattern in Largest of Three
  • I understand the loop-back arrow represents a for/while loop
  • I can trace the Prime Check flowchart's 3 decisions to the 3 conditions in the code
  • I completed the quiz