Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- #include <iomanip>
- #include <math.h>
- #include <cmath>
- #include <string>
- int main()
- {
- int n;
- cin >> n;
- int scoreeven = 0;
- int scoreodd = 0;
- int temp;
- int i = 0;
- do
- {
- cin >> temp;
- if (i % 2 == 0)
- {
- scoreeven += temp;
- }
- else
- {
- scoreodd += temp;
- }
- i += 1;
- } while (i <= n-1);
- if (scoreeven != scoreodd)
- {
- cout << "No" << endl;
- cout << "Diff = " << abs(scoreeven - scoreodd) << endl;
- }
- else
- {
- cout << "Yes" << endl;
- cout << "Sum = " << scoreeven << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement