Marks to letter grade
A worked example to adapt. Rename steps, add branches and owners to match how your team actually works.
Mermaid source for this diagram
flowchart TD
s(["Start"])
in[/"Read marks"/]
d0{"marks < 0 or marks > 100?"}
bad[/"Print invalid marks"/]
d1{"marks ≥ 90?"}
ga["grade = A"]
d2{"marks ≥ 80?"}
gb["grade = B"]
d3{"marks ≥ 70?"}
gc["grade = C"]
d4{"marks ≥ 60?"}
gd["grade = D"]
gf["grade = F"]
out[/"Print grade"/]
e(["End"])
s --> in
in --> d0
d0 -->|Yes| bad
d0 -->|No| d1
d1 -->|Yes| ga
d1 -->|No| d2
d2 -->|Yes| gb
d2 -->|No| d3
d3 -->|Yes| gc
d3 -->|No| d4
d4 -->|Yes| gd
d4 -->|No| gf
ga --> out
gb --> out
gc --> out
gd --> out
gf --> out
out --> e
bad --> ePaste into any Markdown tool that renders Mermaid, such as GitHub.
About this student grade flowchart
Turning a numeric mark into a letter grade is a common first exercise with if-else chains. The flowchart reads one mark, rejects anything outside 0 to 100, and then tests the grade boundaries from the top down.
Testing from the highest boundary first keeps every decision simple. By the time the chart asks marks ≥ 80?, it already knows the mark is below 90, so a Yes means exactly the B range. Testing from the bottom up, or in a random order, needs two comparisons per range and is easy to get wrong.
The boundaries here (90, 80, 70, 60) are one common scale, used as an example. Schools and courses set their own, and many add plus and minus grades. Change the numbers in the diamonds to match yours; the shape of the chart stays the same.
Step by step
- Input. Read the mark.
- Validate. If the mark is below 0 or above 100, print an error and end.
- Top grade. If the mark is 90 or more, the grade is A.
- Next boundaries. Otherwise test 80, 70 and 60 in turn. The first Yes sets the grade.
- Fail. If every test is No, the grade is F.
- Output. All grade boxes join at one output step that prints the grade.
How to make it in flow-chart.io
- Start from the example. Press "Use this template" to open this exact grade calculation flowchart in the editor, or edit the text in the generator box and press Generate for a free preview without signing up.
- 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.
- 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.
- 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
- Trace marks = 85: not invalid, 85 ≥ 90 is No, 85 ≥ 80 is Yes, so the chart prints B.
- Test the edges: 90 should give A, 89 should give B, 60 should give D and 59 should give F. Boundary values are where grade programs usually break.
- Pseudocode: read marks; if marks < 0 or marks > 100 print invalid and stop; if marks ≥ 90 grade = A else if marks ≥ 80 grade = B else if marks ≥ 70 grade = C else if marks ≥ 60 grade = D else grade = F; print grade.
- To grade a whole class, wrap the chart in a loop that reads one mark per student and stops at the end of the list.
- If marks can have decimals, decide where 89.5 belongs and write that rule in the diamonds.
Frequently asked questions
- How do I draw a flowchart to find a student's grade?
- Read the marks, reject values outside 0 to 100, then use a chain of decisions from the highest boundary down: 90 or more is A, 80 or more is B, 70 or more is C, 60 or more is D, otherwise F. Join every grade at one print step.
- Why test the highest grade first?
- Each No rules out every higher grade, so the next question only needs one comparison. It also makes the chart match an if-else if chain in code.
- What if my school uses different grade boundaries?
- Change the numbers in the decision diamonds. You can also add more diamonds for extra grades such as A+ or E.
- Should the invalid check come first?
- Yes. Without it, a mark of 150 would print A and a mark of -5 would print F, which hides typing mistakes.
- Can I edit this grade flowchart?
- Yes. Press Use this template to open it in the editor with a free account, or describe your own grading rules in the generator box.