Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,i,a,mx=INT_MIN,mn=INT_MAX,sum=0;
- cin>>n;
- for(i=0;i<n;i++)
- {
- cin>>a;
- mx=max(mx,a);
- mn=min(mn,a);
- sum=sum+a;
- }
- cout<<sum-mx<<" "<<sum-mn<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment