Answer:
#include <iostream>
using namespace std;
int main() {
int arr[100],n,count=0;
cin>>n;//taking input of size.
for(int i=0;i<n;i++)
cin>>arr[i];//taking input of array elements.
for(int i=0;i<n;i++)
{
if(arr[i]>0)//counting positive integers.
{
count++;
}
}
cout<<"Number of positive integers is "<<count<<endl;//printing the message..
return 0;
}
9
1 8 -8 -6 2 4 6 7 -2
Output:-
Number of positive integers is 6
Step-by-step explanation:
Above written is the code for counting positive integers in an array.I have used a count variable and initialized it with 0.On iterating over the array if the element is greater than 0 means positive then increasing the count by 1.At last printing the message.