Example: Left and Right Sum

Write a program that converts 2 * n integers and checks whether the sum of the first n integers (left sum) equals the sum of the second n numbers (right sum). In case the sums are equal, print "Yes" + the sum, otherwise print "No" + the difference. The difference is calculated as a positive number (by absolute value). The format of the output must be identical to the one in the examples below.

Sample Input and Output

Input Output Input Output
2
10
90
60
40
Yes, sum = 100 2
90
9
50
50
No, diff = 1

results matching ""

    No results matching ""