homework_

 avatar
Alexmegawin
c_cpp
a year ago
387 B
2
Indexable
Never
#include <iostream>
using namespace std;

void average(int* sum, int* count) {

    int num;
    int avg;
    cin >> num;
    
    *count += 1;
    *sum += num;

    avg = *sum / *count;
    cout << avg << endl;
}

int main() {
    int sum = 0;
    int count = 0;

    average(&sum, &count);
    average(&sum, &count);
    average(&sum, &count);

    return 0;
}