Flowchart examples · Programming and algorithms

Flowchart to find the largest of three numbers

Read A, B and C, compare them with two decisions on each path, and print the largest. Includes pseudocode and a worked trace.

Use this template Describe your own version

Largest of three numbers

Largest of three numbersYesNoYesNoYesNoStartRead A, B, CA > B?A > C?B > C?Print A is largestPrint C is largestPrint B is largestEnd
Use this template →Opens this exact diagram in the editor, every box and arrow editable. Free account; no AI credits used.

A worked example to adapt. Rename steps, add branches and owners to match how your team actually works.

Edit the steps to match your process. The free preview (no sign-up) drafts up to 8 main steps; add branches and the remaining steps in the editor.
Mermaid source for this diagram
flowchart TD
  s(["Start"])
  in[/"Read A, B, C"/]
  d1{"A > B?"}
  d2{"A > C?"}
  d3{"B > C?"}
  pa[/"Print A is largest"/]
  pc[/"Print C is largest"/]
  pb[/"Print B is largest"/]
  e(["End"])
  s --> in
  in --> d1
  d1 -->|Yes| d2
  d1 -->|No| d3
  d2 -->|Yes| pa
  d2 -->|No| pc
  d3 -->|Yes| pb
  d3 -->|No| pc
  pa --> e
  pc --> e
  pb --> e

Paste into any Markdown tool that renders Mermaid, such as GitHub.

About this flowchart to find the largest of three numbers

Finding the largest of three numbers is a standard first exercise in flowcharts and programming because it practices nested decisions: the answer to the first comparison decides which comparison you make next.

The flowchart reads three numbers, A, B and C. It first compares A with B. If A is larger, the only remaining question is whether A is also larger than C. If B is larger (or equal), the question becomes whether B is larger than C. Every path makes exactly two comparisons and ends with one output, so the chart has three output boxes and one end.

When two numbers are equal, this version still prints a correct largest value: for A = B = 5 and C = 2, the first test is No, then B > C is Yes, so it prints B, which is 5. If your assignment needs a message for equal values, add a separate decision before the comparisons.

Step by step

  1. Start. Begin with the terminator oval.
  2. Input. Read the three numbers into A, B and C. Inputs use the parallelogram symbol.
  3. First comparison. Is A greater than B? This splits the chart into two halves.
  4. Second comparison, Yes side. Is A greater than C? Yes prints A; No prints C.
  5. Second comparison, No side. Is B greater than C? Yes prints B; No prints C.
  6. Output and end. Print the result and stop. All three output boxes lead to the same end oval.

How to make it in flow-chart.io

  1. Start from the example. Press "Use this template" to open this exact largest-of-three flowchart in the editor, or edit the text in the generator box and press Generate for a free preview without signing up.
  2. 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.
  3. 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.
  4. 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

Frequently asked questions

How many decisions does the largest-of-three flowchart need?
Three diamonds in the nested version (each path passes through two), or two in the version that keeps a running max variable.
What happens if two numbers are equal?
The flowchart still prints a value equal to the largest. If you need to report ties, add a decision that checks for equality first.
How do I turn the flowchart into code?
Each diamond becomes an if/else. In Python: if a > b: print(a if a > c else c) else: print(b if b > c else c). The structure is the same in C, Java or JavaScript.
How do I extend it to N numbers?
Use the running max version inside a loop: set max to the first number, then for each remaining number, if it is greater than max, replace max. Print max at the end.
Can I edit this flowchart online?
Yes. Press Use this template to open it in the editor with a free account, or try the text to flowchart tool to draw your own from typed steps without signing up.

Related

Flowchart to check even or odd numberLeap year flowchartFactorial flowchartPrime number flowchartStudent grade flowchartFlowchart symbolsHow to make a flowchartText to flowchart toolAll flowchart examples

Build it from your own words

Describe your process and get an editable diagram. Free to build and edit; Flow Pro adds downloads and unlimited projects.

Start free See pricing