aboutsummaryrefslogtreecommitdiff
path: root/6a/8.4Execrcies6a/8.4Execrcies6a.cpp
blob: 70751a38858d3aa296beb3455993e7ee12b79549 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 8.4Execrcies6a.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

int main()
{
    int amount = 1;
    double totalScore = 0, avg;

    cout << "Input the number of assignments: ";
    cin >> amount;

    for (int i = 1; i <= amount; i++) {
        cout << "Input the next score: ";
        double score;
        cin >> score;
        totalScore += score;
    }

    if (amount < 1) {
        amount = 1;
    }

    avg = totalScore / amount;
    cout << "The average score is " << avg << ".";

}