fork download
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int n;
  8. cin>>n;
  9. int a[n];
  10. for(int i=0;i<n;i++){
  11. cin>>a[i];
  12. }
  13. int max1=*max_element(a,a+n);
  14. int min1=*min_element(a,a+n);
  15. cout<<max1<<"-->"<<min1;
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5288KB
stdin
8
3 1 4 5 9 8 7 6
stdout
9-->1