Five
different numbers are input in an array. Write a program to determine how many
of them are positive, negative, even and odd
#include <iostream>using namespace std;
main ()
{
int a[10],pos=0,neg=0,even=0,odd=0;
for(int i=0;i<10;i++)
{
cout<<"enter the number"<<i+1<<" = ";
cin>>a[i];
}
for (int i=0;i<10;i++)
{
if(a[i]>=0)
pos++;
else
neg++;
if(a[i]%2==0)
even++;
else
odd++;
}
cout<<"positive number is = "<<pos<<endl;
cout<<"negative number is = "<<neg<<endl;
cout<<"even number is = "<<even<<endl;
cout<<"odd number is = "<<odd<<endl;
}
0 on: "4. Five different numbers are input in an array. Write a program to determine how many of them are positive, negative, even and odd"