Skip to content
Programming101
Programmingoneonone

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programmingoneonone

Learn everything about programming

C program to print the total marks obtained by a student

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program in which a class of n students takes an annual examination in m subjects. a program to read the marks obtained by each student in various subjects and to compute and print the total marks obtained by each of them in C Programming with practical program code and step-by-step full complete explanation.

C program to print the total marks obtained by a student

C Program to print the total marks obtained by a student.

 
#include<stdio.h>
#include<conio.h>

#define FIRST 360
#define SECOND 240

void main()
{
    int n,m,i,j,roll_number,marks,total;

    printf("Enter number of students and subjects");
    scanf("%d%d",&n,&m);
    printf("n");

    for(i=1;i<=n;++i)
    {
        printf("Enter roll number: ");
        scanf("%d",&roll_number);

        total=0;
        printf("Enter marks of %d subjects for ROLL NO %d", m,roll_number);

        for(j=1;j<=m;j++)
        {
            scanf("%d",&marks);
            total=total+marks;
        }

        printf("TOTAL MARKS = %d",total);

        if(total>=FIRST)
            printf("(First division)");
        else if(total>=SECOND)
            printf("(Second division)");
        else
            printf("(***FAIL***)");
    }
}

Output

 
Enter number of students and subjects
3 6
Enter roll number: 8701
Enter marks of 6 subjects for ROLL NO 8701
81 75 83 45 61 59
TOTAL MARKS = 404 (First division)
Enter roll number: 8702
Enter marks of 6 subjects for ROLL NO 8702
51 49 55 47 65 41
TOTAL MARKS = 308 (Second division)
Enter roll number: 8704
40 19 31 47 39 25
TOTAL MARKS = 201 (**FAIL***)
c coding problems solutions

Post navigation

Previous post
Next post
  • Automating Image Format Conversion with Python: A Complete Guide
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
How to download udemy paid courses for free

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes
Programming101
Programmingoneonone

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions