Tech Study

C++ To Calculate Total Marks Percentage Division Of Student

Introduction

C++ program to input roll number, student name and marks of three subjects (Physics, Chemistry and Information Technology) and calculate total marks, percentage and division of student. I have used DEV-C++ compiler for debugging purpose. But you can use any C programming language compiler as per your availability.

#include<iostream>
#include<string.h>
using namespace std;

int main()
{
    int rollno, phy, che, it, total;
    float percentage;
    char name[20], div[10];

    cout << "Input the Roll Number of the student :";
    cin >> rollno;

    cout << "Input the Name of the Student :";
    cin >> name;

    cout << "Input the marks of Physics, Chemistry and Information Technology: ";
    cin >> phy >> che >> it;

    total = phy + che + it;
    percentage = total/3.0;

    if (percentage >= 60)
    strcpy(div, "First");

    else
    if (percentage < 60 && percentage >= 48)
        strcpy(div,"Second");

    else
        if (percentage <48 && percentage >= 36)
        strcpy(div, "Pass");

         else
        strcpy(div, "Fail");

       cout << "Roll No : " << rollno <<endl << "Name of Student : " << name <<endl;

       cout << "Marks in Physics : " << phy << endl;
       cout << "Marks in Chemistry : " << che << endl;
       cout << "Marks in Information Technology : " << it << endl;
       cout << "Total Marks = " << total <<endl;
       cout << "Percentage = " << percentage <<endl;
       cout << "Division = " << div <<endl;


}

Result

C++ program to calculate the total marks, percentage and division of student based on three subjects
C++ program to calculate the total marks, percentage and division of student based on three subjects

C Program to Calculate Percentage Marks & Division

Write C# Program to calculate the total marks, percentage and division of student based on three subjects

TaggedC program to calculate the total markspercentage and division of student based on three subjects

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more