+ 4

Write a program to find the arithmetic mean of a data set?

example 42, 86, 864, 376, 446, 55 solution: 311.5

2nd Jul 2018, 4:19 AM
Shamsulhaq Alkozay
Shamsulhaq Alkozay - avatar
3 odpowiedzi
+ 1
https://code.sololearn.com/cX465sPSt6p1/?ref=app
2nd Jul 2018, 4:30 AM
estifanos
estifanos - avatar
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; }
2nd Jul 2018, 7:59 PM
Louie
Louie  - avatar