Так как язык указан не был, написал на C++
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#include
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
const size_t len = 40;
int arr[40];
for (size_t i = 0; i < len; ++i)
arr[i] = 5 - rand() % (10);
size_t count = 0;
for (size_t i = 0; i < len; ++i)
if (arr[i] > 0)
count++;
cout << count << endl;return 0;<br>}