student mark list in C, result generator in C, C mini project, C programming examples, console project, marksheet program in C, grade calculator in C, Tamil Technicians C course, arrays and structs in C, file handling C project,

Mini C Project – Student Mark List & Result Generator in C (Console Project)

Mini C Project – Student Mark List & Result Generator in C (Console Project) | Tamil Technicians

Tamil Technicians – C Programming Course · Mini Project & Practice

Mini C Project – Student Mark List & Result Generator in C (Console Project)

A Student Mark List & Result Generator is one of the most popular mini projects in C. It is simple enough for beginners, but powerful enough to cover real-world concepts: arrays, structures, loops, functions, conditionals and even file handling.

In this detailed tutorial, we’ll design and implement a console-based C mini project that:

  • Stores details of multiple students (roll number, name, marks in multiple subjects).
  • Calculates total marks, average and grade for each student.
  • Determines pass/fail status based on subject-wise and overall criteria.
  • Displays a neat mark sheet and class summary in the terminal.
  • Optionally saves results to a text file for future reference.
Student mark list and result generator mini C project with console marksheet and class summary
Figure: Console-based Student Mark List & Result Generator in C – shows subject-wise marks, total, average, grade and pass/fail status.

1. Project Overview – What We Are Building

Imagine you are a teacher or lab in-charge. For each class, you want to quickly enter student marks and generate:

  • An individual mark sheet (roll number, name, subject marks, total, average, grade).
  • A class summary: number of students passed, failed, and class topper.
Input

Student Details

Number of students, roll number, name, subject marks for each student.

Processing

Results

Calculate total, average, grade, pass/fail, and find class topper.

Output

Mark Sheet

Print formatted mark list per student and overall class summary on the console.

Extensions

File Save

Save student results to a text file for later viewing or printing.

C Concepts Used

This mini project will consolidate your understanding of:

  • Arrays – storing marks for each subject and multiple students.
  • Structures – grouping related data for each student.
  • Functions – for calculating grades, printing mark sheets, saving to file.
  • Loops & conditionals – for iterating over students and applying pass/fail rules.
  • File handling – optional step for writing results to disk.

2. Requirements & Assumptions

Before we design the program, we define a few assumptions to keep things clean:

  • We will handle up to 50 students in a class.
  • Each student has marks in 5 subjects (e.g., Tamil, English, Maths, Science, Computer).
  • Marks are out of 100 for each subject.
  • Passing criteria:
    • Each subject mark must be >= 35.
    • OR you can modify this threshold easily later.
  • Grade rules (you can customize):
    • A+ for average ≥ 90
    • A for average ≥ 80
    • B for average ≥ 70
    • C for average ≥ 60
    • D for average ≥ 50
    • F for average < 50 or any subject failed
You can adapt the number of subjects, passing rule and grade boundaries to match your syllabus (school, diploma, engineering, etc.). The code is written in a way that makes such changes easy.

3. Designing Data Structures – struct Student

To represent a student, we need multiple pieces of information grouped together. In C, the best tool for this is a struct.

3.1 Student structure fields

  • rollNo – integer.
  • name – string (array of chars).
  • marks[5] – array of integers, one per subject.
  • total – integer or float (sum of marks).
  • average – float.
  • grade – character (A+, A, B, etc.; we can use a string or just a char).
  • result – string like “PASS” or “FAIL”.
#define MAX_SUBJECTS 5

typedef struct {
    int   rollNo;
    char  name[50];
    int   marks[MAX_SUBJECTS];
    int   total;
    float average;
    char  grade[3];   // e.g., "A+", "B", "F"
    char  result[10]; // "PASS" or "FAIL"
} Student;

For the entire class, we will have an array of Student:

#define MAX_STUDENTS 50

Student students[MAX_STUDENTS];
int studentCount;

4. Designing the Program Flow

It’s always better to think about the overall flow before writing code. Here is a simple step-by-step plan:

  1. Display a welcome heading for the result generator.
  2. Ask how many students (studentCount).
  3. For each student:
    • Read roll number and name.
    • Read marks for each subject.
    • Compute total, average.
    • Determine grade and pass/fail result.
  4. After data entry:
    • Print a formatted mark list for the whole class (table view).
    • Print a detailed mark sheet for each student (optional).
    • Find and display class topper (highest total or average).
    • Show number of students passed and failed.
  5. Ask user if they want to save results to file.
  6. Exit the program.
Function Planning

We can break the logic into reusable functions:

  • void inputStudentData(Student *s, int rollIndex)
  • void calculateResult(Student *s)
  • void printClassTable(Student s[], int n)
  • void printStudentDetail(const Student *s)
  • int findTopperIndex(Student s[], int n)
  • void saveResultsToFile(Student s[], int n, const char *filename)

5. Result & Grade Logic

We separate the calculation logic into a function that:

  • Computes total and average.
  • Checks if any subject is below the pass mark (e.g., 35).
  • Assigns a grade based on average (if passed in all subjects).
  • Sets the result string to “PASS” or “FAIL”.
#define PASS_MARK 35

void calculateResult(Student *s) {
    int i;
    int failed = 0;

    s->total = 0;
    for (i = 0; i < MAX_SUBJECTS; i++) {
        s->total += s->marks[i];
        if (s->marks[i] < PASS_MARK) {
            failed = 1;
        }
    }

    s->average = s->total / (float)MAX_SUBJECTS;

    if (failed) {
        strcpy(s->grade, "F");
        strcpy(s->result, "FAIL");
        return;
    }

    if (s->average >= 90) {
        strcpy(s->grade, "A+");
    } else if (s->average >= 80) {
        strcpy(s->grade, "A");
    } else if (s->average >= 70) {
        strcpy(s->grade, "B");
    } else if (s->average >= 60) {
        strcpy(s->grade, "C");
    } else if (s->average >= 50) {
        strcpy(s->grade, "D");
    } else {
        strcpy(s->grade, "F");
        failed = 1;
    }

    if (failed) {
        strcpy(s->result, "FAIL");
    } else {
        strcpy(s->result, "PASS");
    }
}
You can customize the grade bands easily. For some boards, you may prefer using only A/B/C/ or including “Distinction” for averages above 75 or 80.

6. Full Code – Student Mark List & Result Generator (Console)

Below is a complete C program that:

  • Reads multiple students’ marks.
  • Calculates total, average, grade and result.
  • Prints a class-wise mark list table and topper information.
  • Optionally saves data to a text file.
#include <stdio.h>
#include <string.h>

#define MAX_STUDENTS 50
#define MAX_SUBJECTS 5
#define PASS_MARK 35

typedef struct {
    int   rollNo;
    char  name[50];
    int   marks[MAX_SUBJECTS];
    int   total;
    float average;
    char  grade[3];   // "A+", "B", "C", "F"
    char  result[10]; // "PASS" or "FAIL"
} Student;

void inputStudentData(Student *s, int index) {
    int i;

    printf("\\n---- Enter details for student %d ----\\n", index + 1);
    printf("Roll number: ");
    scanf("%d", &s->rollNo);

    printf("Name: ");
    scanf(" %49[^\n]", s->name);

    printf("Enter marks for %d subjects (out of 100):\\n", MAX_SUBJECTS);
    for (i = 0; i < MAX_SUBJECTS; i++) {
        printf("Subject %d: ", i + 1);
        scanf("%d", &s->marks[i]);

        if (s->marks[i] < 0) {
            s->marks[i] = 0;
        } else if (s->marks[i] > 100) {
            s->marks[i] = 100;
        }
    }
}

void calculateResult(Student *s) {
    int i;
    int failed = 0;

    s->total = 0;
    for (i = 0; i < MAX_SUBJECTS; i++) {
        s->total += s->marks[i];
        if (s->marks[i] < PASS_MARK) {
            failed = 1;
        }
    }

    s->average = s->total / (float)MAX_SUBJECTS;

    if (failed) {
        strcpy(s->grade, "F");
        strcpy(s->result, "FAIL");
        return;
    }

    if (s->average >= 90) {
        strcpy(s->grade, "A+");
    } else if (s->average >= 80) {
        strcpy(s->grade, "A");
    } else if (s->average >= 70) {
        strcpy(s->grade, "B");
    } else if (s->average >= 60) {
        strcpy(s->grade, "C");
    } else if (s->average >= 50) {
        strcpy(s->grade, "D");
    } else {
        strcpy(s->grade, "F");
        failed = 1;
    }

    if (failed) {
        strcpy(s->result, "FAIL");
    } else {
        strcpy(s->result, "PASS");
    }
}

void printClassTable(Student s[], int n) {
    int i, j;

    printf("\\n===============================================================\\n");
    printf("                STUDENT MARK LIST - CLASS SUMMARY               \\n");
    printf("===============================================================\\n");
    printf("%-6s %-20s ", "Roll", "Name");
    for (i = 0; i < MAX_SUBJECTS; i++) {
        printf("S%-2d ", i + 1);
    }
    printf(" Total  Avg   Gr  Result\\n");
    printf("---------------------------------------------------------------\\n");

    for (i = 0; i < n; i++) {
        printf("%-6d %-20s ", s[i].rollNo, s[i].name);
        for (j = 0; j < MAX_SUBJECTS; j++) {
            printf("%-4d ", s[i].marks[j]);
        }
        printf("%-6d %-5.1f %-3s %-6s\\n",
               s[i].total, s[i].average, s[i].grade, s[i].result);
    }

    printf("===============================================================\\n");
}

void printStudentDetail(const Student *s) {
    int i;

    printf("\\n---------------- STUDENT RESULT ----------------\\n");
    printf("Roll No : %d\\n", s->rollNo);
    printf("Name    : %s\\n", s->name);
    printf("------------------------------------------------\\n");
    for (i = 0; i < MAX_SUBJECTS; i++) {
        printf("Subject %d: %d\\n", i + 1, s->marks[i]);
    }
    printf("------------------------------------------------\\n");
    printf("Total   : %d\\n", s->total);
    printf("Average : %.2f\\n", s->average);
    printf("Grade   : %s\\n", s->grade);
    printf("Result  : %s\\n", s->result);
    printf("------------------------------------------------\\n");
}

int findTopperIndex(Student s[], int n) {
    int i, topperIndex = 0;
    for (i = 1; i < n; i++) {
        if (s[i].total > s[topperIndex].total) {
            topperIndex = i;
        }
    }
    return topperIndex;
}

void saveResultsToFile(Student s[], int n, const char *filename) {
    int i, j;
    FILE *fp = fopen(filename, "w");

    if (fp == NULL) {
        printf("Error: Could not open %s for writing.\\n", filename);
        return;
    }

    fprintf(fp, "STUDENT MARK LIST & RESULT SHEET\\n\\n");
    fprintf(fp, "%-6s %-20s ", "Roll", "Name");
    for (i = 0; i < MAX_SUBJECTS; i++) {
        fprintf(fp, "S%-2d ", i + 1);
    }
    fprintf(fp, " Total  Avg   Gr  Result\\n");
    fprintf(fp, "---------------------------------------------------------------\\n");

    for (i = 0; i < n; i++) {
        fprintf(fp, "%-6d %-20s ", s[i].rollNo, s[i].name);
        for (j = 0; j < MAX_SUBJECTS; j++) {
            fprintf(fp, "%-4d ", s[i].marks[j]);
        }
        fprintf(fp, "%-6d %-5.1f %-3s %-6s\\n",
                s[i].total, s[i].average, s[i].grade, s[i].result);
    }

    fclose(fp);
    printf("Results successfully saved to %s\\n", filename);
}

int main() {
    Student students[MAX_STUDENTS];
    int n, i;
    int passCount = 0, failCount = 0;
    int topperIndex;
    char choice;

    printf("===============================================\\n");
    printf(" STUDENT MARK LIST & RESULT GENERATOR (C)\\n");
    printf("===============================================\\n\\n");

    printf("Enter number of students (max %d): ", MAX_STUDENTS);
    scanf("%d", &n);

    if (n <= 0 || n > MAX_STUDENTS) {
        printf("Invalid number of students. Exiting.\\n");
        return 1;
    }

    // Input and calculate for each student
    for (i = 0; i < n; i++) {
        inputStudentData(&students[i], i);
        calculateResult(&students[i]);
    }

    // Count pass/fail
    for (i = 0; i < n; i++) {
        if (strcmp(students[i].result, "PASS") == 0) {
            passCount++;
        } else {
            failCount++;
        }
    }

    // Find topper
    topperIndex = findTopperIndex(students, n);

    // Print class table
    printClassTable(students, n);

    // Print class summary
    printf("\\nCLASS SUMMARY:\\n");
    printf("Total students : %d\\n", n);
    printf("Passed         : %d\\n", passCount);
    printf("Failed         : %d\\n", failCount);
    printf("Topper         : %s (Roll %d, Total %d, Avg %.2f, Grade %s)\\n",
           students[topperIndex].name,
           students[topperIndex].rollNo,
           students[topperIndex].total,
           students[topperIndex].average,
           students[topperIndex].grade);

    // Optionally print detail for one student
    printf("\\nDo you want to see detail of a student? (y/n): ");
    scanf(" %c", &choice);
    if (choice == 'y' || choice == 'Y') {
        int roll;
        printf("Enter roll number to view detail: ");
        scanf("%d", &roll);

        int found = 0;
        for (i = 0; i < n; i++) {
            if (students[i].rollNo == roll) {
                printStudentDetail(&students[i]);
                found = 1;
                break;
            }
        }
        if (!found) {
            printf("No student found with roll number %d.\\n", roll);
        }
    }

    // Optionally save results to file
    printf("\\nDo you want to save the results to a file? (y/n): ");
    scanf(" %c", &choice);
    if (choice == 'y' || choice == 'Y') {
        saveResultsToFile(students, n, "results.txt");
    }

    printf("\\nProgram ended. Goodbye!\\n");
    return 0;
}
Compile with: gcc student_result.c -o student_result Run with: ./student_result (Linux/macOS) or student_result.exe (Windows).

7. Testing the Mini Project – Sample Scenario

Let’s walk through a sample test to ensure the logic works:

Example Input (3 students, 5 subjects)

  • Student 1:
    • Roll: 101
    • Name: Arun
    • Marks: 80, 75, 90, 85, 88
  • Student 2:
    • Roll: 102
    • Name: Bala
    • Marks: 60, 55, 45, 50, 58
  • Student 3:
    • Roll: 103
    • Name: Charu
    • Marks: 30, 40, 50, 60, 70 (note: first subject is below pass mark)

The program should:

  • Compute totals and averages correctly.
  • Assign grade and result:
    • Arun – high average, likely A or A+ and PASS.
    • Bala – average around 53.6 (PASS, grade D).
    • Charu – FAIL because of subject 1 < 35 (grade F).
  • Show class summary – 2 passed, 1 failed, topper = Arun.
Try multiple test cases:
  • All students pass.
  • All students fail in at least one subject.
  • Edge case: marks = 35 exactly (should pass).
  • Marks input < 0 or > 100 (program clamps to 0 or 100 as written).

8. Extension Ideas – Make the Project More Powerful

Once the basic project works, you can level it up with new features:

8.1 Custom subject names

Instead of just “Subject 1, 2, 3…”, allow the user to enter subject names at the beginning:

char subjectNames[MAX_SUBJECTS][30];
int i;

printf("Enter names of %d subjects:\\n", MAX_SUBJECTS);
for (i = 0; i < MAX_SUBJECTS; i++) {
    printf("Subject %d name: ", i + 1);
    scanf(" %29[^\n]", subjectNames[i]);
}

Then use subjectNames[i] when printing.

8.2 Class-wise statistics

  • Average marks per subject across all students.
  • Highest and lowest mark per subject.
  • Overall class average.

8.3 Ranking

Sort students by total or average and assign ranks. You can use a simple bubble sort for small numbers of students.

8.4 Multiple classes or sections

Extend the program to handle multiple classes (e.g., Class 10A, 10B, 10C) using an outer loop or another structure.

8.5 Export to CSV

Instead of a free-form text file, write results in CSV format so that they can be opened directly in Excel or Google Sheets:

fprintf(fp, "Roll,Name,S1,S2,S3,S4,S5,Total,Average,Grade,Result\n");

9. Learning Checklist – Student Mark List Mini Project

  • I can design a struct Student with roll number, name, marks and result fields.
  • I can store multiple students in an array and iterate through them with loops.
  • I understand how to compute total and average from subject marks.
  • I can implement pass/fail and grade logic using if–else conditions.
  • I can format console output into a neat table (class-wise mark list).
  • I can write helper functions to keep main() clean and modular.
  • I can use file handling to save results to a text/CSV file.
  • I can extend the mini project with features like topper, ranking and subject statistics.

FAQ: Student Mark List & Result Generator in C

1. Is this mini project suitable for first-year or diploma students?

Yes. This project is ideal for first-year engineering, diploma, B.Sc., BCA and ITI students who have covered the basics of C (arrays, loops, if, switch). It demonstrates a realistic use case and can be shown in labs and internal assessments.

2. Do I need pointers and dynamic memory for this project?

No. The basic version uses static arrays and structures. You don’t need dynamic memory (malloc()) to complete it. However, if you later want to support a very large number of students, you can convert the arrays to dynamically allocated memory as an advanced exercise.

3. Can I customize the number of subjects and passing criteria?

Absolutely. Just change MAX_SUBJECTS, update the marks input loop and modify PASS_MARK or the grade boundaries in calculateResult(). The structure of the code makes such changes straightforward.

4. How can I present this project in my viva or lab exam?

Prepare a short explanation of the problem statement, show your data structures (the Student struct), walk through the logic for calculating total, average and grade, and then run the program with sample input. Highlight any extensions you’ve implemented, such as file saving, topper calculation or ranking. This shows both coding and design understanding.

Category: C Programming Course · Lesson – Mini C Project (Student Mark List & Result Generator in C)


Buy link ;

Dell 15, AMD Ryzen 3 7320U Processor (8GB RAM / 512GB SSD/Windows 11 + Office H&S 2024 + M365 / 15.6″(39.62 Cm) FHD Display / 12 Month Mcafee/Black Color/ 1.63 Kg/Thin & Light Laptop.


Contact link ;

Click Here >>>>>


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top