Question #275288

Write two procedure called mean_(int N) and var_(int N) that calculate and display the mean and variance of N real entered from the keyboard (without using an array).


Expert's answer

double mean_(int n) {
    double foo = 0;
    for (int i = 0; i < n; i++ ){
        double bar;
        cin >> bar;
        foo += bar;
    }
    return foo/n;
}
LATEST TUTORIALS
APPROVED BY CLIENTS