PROBLEM LINK:
DIFFICULTY:
CakeWalk
PREREQUISITES:
None at all
PROBLEM:
Find out how many total handshakes you performed. Note that you are meeting only those groups which have an even number of batchmates.
EXPLANATION:
Calculate Sum of Even Values in an Array
SOLUTIONS:
Solution
#include<iostream>
using namespace std;
int main()
{
int n;
int sum=0;
int x;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>x;
if(x%2==0)
{
sum+=x;
}
}
cout<<sum;
return 0;
}