Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions minmax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Problem Statement:Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.


def min_maxSum(arr):
sum = 0
max = 0
min = 9999999999999999999
n = len(arr)
for i in range(n):
sum+=arr[i]
min = min(min, arr[i])
max = max(max, arr[i])

print(sum-max, sum-min)

if __name__ == "__main__":
arr = list(map(int, input().rstrip().split()))
min_maxSum(arr)