An array of integers is given. Write a program that counts the number of positive numbers

An array of integers is given. Write a program that counts the number of positive numbers among the elements of an array. In c ++ the input is 5 1 2 3 -1 -4 the output is 3

#include <iostream>
using namespace std;
int a [5]; // set up an array with five elements
int main ()
{
int i, s = 0; // describe variables of integer type, set the initial value
int n;
cin >> n; // enter the number of elements in the array
for (i = 1; i <= n; i ++) // organize a loop for n repetitions
{
cin >> a [i]; // enter an array element from the keyboard
if (a [i]> 0) {s ++; } // check the array element, if positive, then count it
}

cout << “Otvet =” << s; // display the answer
return 0;
}



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.