Write a program that counts the number of positive elements in a one-dimensional array.

C # language

Random rand = new Random (); // declaring an instance of the Random class
int [] array = new int [rand.Next (8, 21)]; // create an array of 8 to 20 elements
for (int i = 0; i <array.Length; i ++)
{
array [i] = rand.Next (-100,101); // fill the array with numbers from -100 to 100
}

int counter = 0; // variable counter

for (int i = 0; i <array.Length; i ++)
{
if (array [i]> 0) // if array element is positive
{
counter ++; // increase the counter by 1
}
}

Console.WriteLine (“Number of positive array elements:” + counter);
Console.ReadLine (); // read from the console, otherwise it will close



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.