Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int N;
- cin >> N;
- int *arr = new int[N];
- double sum = 0;
- srand(time(NULL));
- for (int i = 0; i < N; i++) {
- cout << (arr[i] = rand() % 101) << ' ';
- if (i % 10 == 0)cout << endl;
- }
- for (int i = 0; i < N; i++) {
- sum += arr[i];
- }
- cout << endl << "answer: " << sum / N;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement