a53

MinPlusMax

a53
Dec 6th, 2021
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,nr,Min=1001,Max=0;
  7. cin>>n;
  8. for(int i=1;i<=n;++i)
  9. cin>>nr,Min=min(nr,Min),Max=max(nr,Max);
  10. cout<<Min+Max<<'\n';
  11. return 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment