Example: Even / Odd Sum

Write a program that inputs n integers and checks whether the sum of the numbers on even positions is equal to the sum of the numbers on odd positions. In case the sums are equal, print "Yes" + the sum, otherwise, print "No" + the difference. The difference is calculated by absolute value. The format of the output must be identical to the examples below.

Sample Input and Output

Input Output
4
10
50
60
20
Yes
Sum = 70
4
3
5
1
-2
No
Diff = 1
3
5
8
1
No
Diff = 2

results matching ""

    No results matching ""