Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <iostream>
- using namespace std;
- #include <iomanip>
- int main()
- {
- int n;
- cin >> n;
- int scoreeven = 0;
- int scoreodd = 0;
- int temp;
- for (int i = 0; i < n; i = i++)
- {
- cin >> temp;
- if (i % 2 == 0)
- {
- scoreeven += temp;
- }
- else
- {
- scoreodd += temp;
- }
- }
- 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