**Problem:-**Write C++ A Program To Sum Of Even-Positive, Even-Negative, Odd-Positive, Odd-Negative Of An Array or C++ Program To Find Sum Of Even Positive and Even Negative Of An Array or C++ Program To Find Sum Of Even Positive and Even Negative Odd Positive and Odd Negative Of An Array or C++ Program To Find Sum Of Odd Positive and Odd Negative Of An Array or C++ Program To Find Sum of Even Positive / Even Negative / Odd Positive / Odd Negative of An Array.

**Check This:-**Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

**Logic:-**Here we need to solve two problems one in even-odd and second in positive-negative and according to the problem, As we know that if the number is divided by 2 then number is even and if not then the number is odd. we can solve before proceeding even-odd. see C Program For Checking Number Is Even Or Odd and if the number is greater than zero then the number is positive and if the number is less then zero then the number is negative. Check for positive-negative see C++ Program To Check Number Is Positive Or Negative.

**Extreme Recommended:-**Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post.

**Solution:-**

#include<iostream>

using namespace std;

int main()

{

int a[100],i,n,k=0,rem=0,sum=0,odde=0,oddn=0;

cout<<"Enter The Size of Array\n";

cin>>n;

cout<<"Enter The Array Element\n";

for(i=0;i<n;i++)

{

cin>>a[i];

}

for(i=0;i<n;i++)

{

if(a[i]>=0)

{

if(a[i]%2==0)

sum=sum+a[i];

else

rem=rem+a[i];

}

else

{

if(a[i]%2==0)

odde=odde+a[i];

else

oddn=oddn+a[i];

}

}

cout<<sum<<" Is Sum of Even-Positive\n";

cout<<rem<<" Is Sum of Odd-Positive\n";

cout<<odde<<" Is Sum of Even-Negative\n";

cout<<oddn<<" Is Sum of Odd-Negative\n";

return 0;

}

**Output:-**

**You May Also See**

1. C++ Program To Find Sum Of Series 1+1/2^2+1/3^3+............1/n^n

2. C++ Program To Find Sum Of Series 1+2+3+4+5+6.......................n

3. C++ Program To Find Sum Of Series x+x^2/2+x^3/3+x^4/4+...........x^n/n

4. C++ Program To Find Sum Of Series 1/2+4/5+7/8+..........

5. C++ Program To Find Sum Of Series 1+x^1+x^2+x^3+...........x^n

6. C++ Program To Find Sum Of Series 1^2+3^2+5^2+............n^2

7. C++ Program For Count A Character In File Using File

8. C++ Program To Display The List Of Current Directory/Folder Using File

9. C++ Program For Copy One File To Another Using File Handling

10. C++ Program To Merge Two File Into the Third File Using File Handling

## 0 Comments: