+ 4
Write a program to find the arithmetic mean of a data set?
example 42, 86, 864, 376, 446, 55 solution: 311.5
3 odpowiedzi
+ 1
https://code.sololearn.com/cX465sPSt6p1/?ref=app
0
#include <iostream>
using namespace std;
int main() {
int numInputs;
cout << "how many numbers in the data set?" << endl;
cin >> numInputs;
float arr[numInputs];
float sum = 0;
cout << "Enter List of numbers" << endl;
for(int i = 0; i < numInputs; i++){
cin >> arr[i];
sum += arr[i];
}
float mean;
mean = sum / numInputs;
cout << "Arithmetic Mean: " << mean << endl;
return 0;
}