Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

addEven (https://github.com/open-source-workshop/idc-katas/issues/4) #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/addEven.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Add all the even values in an array and return the sum.

#include<bits/stdc++.h>

using namespace std;

int main() {
int n;
cout << "Enter the number of elements in array\n";
cin >> n;
int arr[n];
int sum = 0;
for(int i = 0; i < n; i++) {
cin >> arr[i];
if(arr[i] % 2 == 0) {
sum += arr[i];
}
}

cout << sum << "\n";
return 0;
}
1 change: 1 addition & 0 deletions src/calPerimeterPolygon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Calculate the perimeter of polygon