Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "math"
- )
- func main() {
- var n, number int
- fmt.Scanln(&n)
- var sumNumbers = 0
- var maxNumber = 0
- for i := 1; i <= n; i++ {
- fmt.Scanln(&number)
- sumNumbers += number
- if number > maxNumber {
- maxNumber = number
- }
- }
- var result = sumNumbers - maxNumber
- if maxNumber == result {
- fmt.Printf("Yes\nSum = %d\n", maxNumber)
- } else {
- fmt.Printf("No\nDiff = %d\n", int(math.Abs(float64(maxNumber - result))))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement