Fibonacci series

    Last updated November 30, 2026

    The series used here starts 0, 1, 1, 2, 3. Each later term is the sum of the two before it. The chart writes n terms. FlowSimp is completely free to use — no sign-up required.

    See the flowchart

    What does the flowchart look like?

    Ready to draw?

    No signup. Opens instantly in your browser.

    See the flowchart

    What is the matching code?

    Pseudocode

    read n
    if n < 1 then stop
    a = 0
    b = 1
    i = 1
    while i <= n
      write a
      next = a + b
      a = b
      b = next
      i = i + 1

    Python

    def fibonacci(n):
        if n < 1:
            return []
        terms = []
        a, b = 0, 1
        i = 1
        while i <= n:
            terms.append(a)
            a, b = b, a + b
            i += 1
        return terms

    C

    #include <stdio.h>
    void fibonacci(int n) {
      int a = 0, b = 1, i;
      if (n < 1) return;
      for (i = 1; i <= n; i++) {
        int next = a + b;
        printf("%d ", a);
        a = b;
        b = next;
      }
    }
    • n = 1 writes 0. n = 5 writes 0, 1, 1, 2, 3.
    • Some courses start at 1, 1, 2. This chart starts at 0 so the first two terms are the seeds stored in a and b.