C++ Program to find the maximum mark, average- marks and minimum marks


Write a program in C++ to find the maximum mark, average- marks and minimum marks obtained by a student in five papers as given below:

Paper   Marks
Paper 1  50
Paper 2  70
Paper 3  65
Paper 4  80
Paper 5  56

#include<iostream>
using namespace std;

int main()
{
    int marks[5];
    int max = 0, min = 100, sum = 0, avg;

    for (int i = 0; i < 5; i++) 
    {
        cout << "Enter marks in paper " << i + 1 << ": "; 
        cin >> marks[i];
        sum = sum + marks[i];
        if (marks[i] > max)
            max = marks[i];
        if (marks[i] < min)
            min = marks[i];
    }
    avg = sum / 5;
    cout << "Maximum marks is " << max << endl;
    cout << "Minimum marks is " << min << endl;
    cout << "Average marks is " << avg << endl;

    return 0;
}