-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path001
32 lines (25 loc) · 776 Bytes
/
001
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
30
31
32
#include <iostream>
using namespace std;
int main()
{
const int NUMBER_OF_ELEMENTS = 5;
double numbers[NUMBER_OF_ELEMENTS];
double sum = 0;
for (int i = 0; i < NUMBER_OF_ELEMENTS; i++)
{
cout << "Enter a new number: ";
cin >> numbers[i];
sum += numbers[i];
numbers_squared[i]=numbears[i]*numbers[i];
}
cout << "numbers[i] is" <<numbers[i] << end;
cout << "numbers_squared[i] is " << numbers_squared[1] << end];
double average = sum / NUMBER_OF_ELEMENTS;
int count = 0; // The number of elements above average
for (int i = 0; i < NUMBER_OF_ELEMENTS; i++)
if (numbers[i] > average)
count++;
cout << "Average is " << average << endl;
cout << "Number of elements above the average " << count << endl;
return 0;
}