Skip to main content

Step-by-step tutorial

C Tutorial: Build a Student Grade Calculator

Read marks, decide pass or fail, and print a clear result. Each step teaches one C idea you can reuse.

Cbeginner4 min readProgramming tutorials

Learning overview

Estimated time
4 minutes
Difficulty
Beginner
Prerequisites
No prior experience required
Learning outcome
Explain c using a clear mental model · Apply c in practical C work
Last updated
July 18, 2026

What you will build and learn

You will build a grade calculator that stores a score, decides pass or fail, and prints a clear result. Keep the decision separate from printing so each part stays easy to change.

  • Include stdio.h
  • Declare an int score
  • Use if/else for the pass decision
  • Print with printf

Step 1: Create the program skeleton

Every beginner C program needs includes and a main function. main is where execution begins when you press Run.

grade.c
#include <stdio.h>

int main(void) {
  int score = 72;
  if (score >= 40) {
    printf("Pass\n");
  } else {
    printf("Try again\n");
  }
  return 0;
}

Output

Pass

Project extensions

Add a second condition for distinction, or read the score with scanf. Keep changes small and re-run after each edit.

  • Print Distinction when score >= 75
  • Read score with scanf
  • Add a second subject average

Frequently asked questions

Do I need an IDE for this tutorial?

No. A simple editor and a C compiler are enough. Avora Learn also lets you practice visually.

Why return 0?

Returning 0 from main traditionally signals successful program completion.

Topic graph

A taxonomy-generated path through this subject.

  1. C
  2. Programming tutorials
  3. c
  4. tutorial
  5. beginners
  6. printf
  7. What Is C in Programming?
  8. Learn C: From First Program to Systems Thinking
  9. C++ (Cpp) Tutorial: Build a Student Grade Calculator

Recommended automatically from shared technologies, topics, intent, and difficulty.

Hand-picked companion pages that deepen this topic.

Your next steps

Continue learning

  1. 1glossaryWhat Is C in Programming?
  2. 2guidesLearn C: From First Program to Systems Thinking
  3. 3guidesC++ (Cpp) Tutorial: Build a Student Grade Calculator
  4. 4guidesJava Tutorial: Build a Student Grade Calculator