Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- const int MAX_SIZE = 99;
- int numbers[MAX_SIZE]{};
- int arrSize, diff = 0;
- cin >> arrSize;
- for (int i = 0; i < arrSize; i++) {
- cin >> numbers[i];
- }
- for (int i = 0; i < arrSize; i++) {
- diff += (numbers[i] % 2 == 0 ? numbers[i] : -numbers[i]);
- }
- cout << diff << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement