Flowchart gallery

See which flowchart each code produces — loops, recursion, lambdas and more. Open any one fullscreen or edit it in the editor.

160 examples

Grade by score
Branching · if / elif / else
Python
Max of two
Branching · if / else
C++
Even / odd
Branching · if / else
C#
Sign of a number
Branching · if / else if / else
Java
Ternary operator
Branching · ?: → branching
C++
Leap year
Branching · compound condition
Python
Day of week
Switch / case · switch + default
C++
match / case
Switch / case · structural pattern matching
Python
Letter grade
Switch / case · switch over ranges
Java
case .. of
Switch / case · case in Pascal
Pascal
switch-expression
Switch / case · C# switch
C#
Sum 1..n
Loops · for + range
Python
Factorial (loop)
Loops · for with accumulation
C++
Array sum
Loops · for over an array
C
Reverse a number
Loops · while
C++
do / while
Loops · post-condition loop
C++
repeat .. until
Loops · post-condition in Pascal
Pascal
foreach
Loops · foreach over a collection
C#
for-each
Loops · for (T x : c)
Java
for .. downto
Loops · descending for
Pascal
Factorial (recursion)
Recursion · self-call → subroutine
Python
Fibonacci numbers
Recursion · double recursion
Python
Exponentiation
Recursion · recursive power
C++
Digit sum
Recursion · recursion over digits
Java
Named lambda
Lambdas · name = lambda → separate diagram
Python
Lambda max
Lambdas · lambda + ternary
Python
Lambda in C++
Lambdas · auto f = [](){…}
C++
Greeting
Input/Output · input → print
Python
Sum from input
Input/Output · cin / cout
C++
Doubling
Input/Output · readln / writeln
Pascal
Read a value
Input/Output · Console.ReadLine / WriteLine
C#
Safe division
Exceptions · try / except
Python
Parse a number
Exceptions · try / catch
Java
Counter
Classes & methods · class method
Java
Reverse a string
Classes & methods · static method
C#
Circle area
Classes & methods · class method
C++
Bubble sort
Algorithms · nested loops + swap
Python
Linear search
Algorithms · loop + return index
Java
Primality test
Algorithms · loop with early return
C++
Binary search
Algorithms · while + branching
Python
FizzBuzz
Algorithms · loop + multiple conditions
Python
GCD (Euclid)
Algorithms · while + I/O
Pascal
Power (loop)
Algorithms · while accumulation
C#
Insertion sort
Algorithms · insertion sort
C++
Selection sort
Algorithms · selection sort
Java
Sieve of Eratosthenes
Algorithms · primes up to n
C++
Palindrome
Algorithms · string palindrome
Python
Reverse a string
Algorithms · reverse a string
C#
Count vowels
Loops · how many vowels
Python
Towers of Hanoi
Recursion · classic recursion
Python
LCM
Algorithms · least common multiple
C
To binary
Algorithms · decimal → binary
C++
Max in an array
Loops · largest element
C
Sum of evens
Loops · evens up to n
Pascal
Digit count
Loops · how many digits
Pascal
Category by age
Branching · if / else
JavaScript
Sign of a number
Branching · if / else if + types
TypeScript
Grade by score
Branching · if / elseif / else
PHP
Grade by score
Branching · if / else if / else
Go
Size by number
Switch / case · switch + default
TypeScript
Day of week
Switch / case · switch + default
Go
Color by code
Switch / case · match expression
PHP
Day name
Switch / case · switch + default
JavaScript
Size by number
Switch / case · switch + default
PHP
Array sum
Loops · for-of
JavaScript
Slice sum
Loops · for + range
Go
Sum of items
Loops · foreach
PHP
Reverse a number
Loops · while
JavaScript
Factorial (loop)
Loops · for with accumulation
JavaScript
Array sum
Loops · for + types
TypeScript
Reverse a number
Loops · while
TypeScript
Reverse a number
Loops · for (while form)
Go
Factorial (recursion)
Recursion · recursion
TypeScript
Fibonacci numbers
Recursion · double recursion
Go
Exponentiation
Recursion · recursive power
JavaScript
Digit sum
Recursion · recursion over digits
PHP
Arrow function
Lambdas · name = arrow → separate diagram
JavaScript
Arrow function
Lambdas · arrow + types
TypeScript
Closure
Lambdas · closure assigned to name
PHP
Greeting
Input/Output · prompt → console.log
JavaScript
Greeting
Input/Output · prompt → console.log
TypeScript
Sum from input
Input/Output · fmt.Scan / Println
Go
Greeting
Input/Output · readline → echo
PHP
Safe division
Exceptions · try / catch
JavaScript
Parse a number
Exceptions · try / catch
TypeScript
Safe division
Exceptions · returning an error
Go
Safe division
Exceptions · try / catch
PHP
Counter
Classes & methods · class method
TypeScript
Circle area
Classes & methods · class method
PHP
Counter
Classes & methods · class method
JavaScript
Circle area
Classes & methods · method with receiver
Go
Account deposit
Classes & methods · method with receiver
Go
Linear search
Algorithms · loop + return index
JavaScript
Primality test
Algorithms · loop with early return
Go
Bubble sort
Algorithms · nested loops + swap
JavaScript
Primality test
Algorithms · loop with early return
TypeScript
Binary search
Algorithms · while + branching
TypeScript
GCD (Euclid)
Algorithms · while + swap
Go
GCD (Euclid)
Algorithms · while loop
PHP
Linear search
Algorithms · loop + return index
PHP
Quadratic equation
Branching · discriminant, if / else
Pascal
Multiplication table
Loops · nested for loops
Pascal
Armstrong number
Loops · sum of digit cubes
Python
Perfect number
Loops · sum of divisors
C++
Prime factorization
Algorithms · division loop
Python
Bisection method
Algorithms · numeric method, while
C++
Pi (Leibniz series)
Loops · alternating series
C
Array average
Loops · sum / count
Java
Array minimum
Algorithms · find smallest
Go
Matrix transpose
Loops · nested loops, swap
C++
Main diagonal sum
Loops · loop over diagonal
Java
Swap two variables
Input/Output · via temp variable
Pascal
Quick sort
Recursion · divide and conquer
C++
Newton's method
Algorithms · loop + update
C++
Trapezoidal rule
Algorithms · numeric integration
Pascal
Rectangle rule
Algorithms · numeric integration
Java
Taylor series for e^x
Algorithms · series accumulation
C#
Taylor series for sin
Algorithms · alternating series
Python
Horner's scheme
Algorithms · polynomial evaluation
C++
Matrix multiplication
Loops · nested loops
Java
Symmetric matrix check
Loops · nested loops
C++
Maximum in a matrix
Loops · nested loops
Pascal
Row sums of a matrix
Loops · nested loops
C#
Anti-diagonal sum
Loops · loop over diagonal
Go
Word count
Loops · loop over characters
TypeScript
Substring search
Algorithms · nested loops
C++
Character frequency
Loops · counting in an array
Java
Anagram check
Algorithms · character counting
C#
Caesar cipher
Algorithms · character shift
Pascal
Count uppercase letters
Loops · loop + condition
JavaScript
Is all digits
Loops · loop + condition
PHP
Collatz conjecture
Loops · while + branching
Python
Digital root
Loops · nested loops
C++
Amicable numbers
Algorithms · sum of divisors
Java
Triangular number
Loops · sum accumulation
Pascal
Sum of proper divisors
Loops · loop + condition
C#
Count divisors
Loops · loop + counter
Go
Palindrome number
Algorithms · reversing a number
C++
Fast exponentiation
Algorithms · binary exponentiation
Java
To hexadecimal
Algorithms · loop + array
C++
Solving a linear equation
Branching · if / else if / else
Pascal
Quadratic discriminant
Branching · if / else if / else
C#
Power (recursion)
Recursion · recursion
C++
Sum 1..n (recursion)
Recursion · recursion
Java
GCD (recursion)
Recursion · Euclid recursion
Python
String reverse (recursion)
Recursion · recursion
TypeScript
Digit count
Recursion · recursion over digits
Pascal
Ackermann function
Recursion · double recursion
C++
Celsius to Fahrenheit
Input/Output · formula + output
Python
Simple interest
Input/Output · formula + output
Pascal
Compound interest
Loops · loop over years
Java
Minimum of three
Branching · sequential ifs
C
Sort three numbers
Branching · swap via if
C
Triangle area (Heron)
Input/Output · Heron's formula
C#
Rectangle perimeter and area
Input/Output · two formulas
PHP
Array-based stack
Classes & methods · push / pop
Java
Array-based queue
Classes & methods · enqueue / dequeue
C++
Count occurrences
Loops · loop + counter
TypeScript
Remove duplicates
Algorithms · nested loops
Python
Second largest element
Algorithms · two maxima
Go