Create an array of 10 random numbers in the range from -20 to 20. Determine the arithmetic mean of the positive elements of the array.
Update 1
I did this:
#include <ctime> #include <cstdlib> using namespace std; void main() { setlocale(0, "rus"); const int n = 10; int num[n]; int num_1 = 0; srand(time(0)); num_1 = rand() % 41 - 20; for (int i = 0; i < 10; i++) { cout << num_1<< endl; i++; } } Update 2
setlocale(0, "rus"); const int n = 10; int num[n]; int num_1 = 0; srand(time(0)); num_1 = rand() % 41 - 20; for (int i = 0; i < 10; i++) { cout << num_1 << endl; } It is impossible to output all 10 numbers different.