Advertisement
alex326

Untitled

Apr 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. problema 82
  2.  
  3. #include <fstream>
  4. using namespace std;
  5. ifstream fin("minmax.in");
  6. ofstream fout("minmax.out");
  7. int main()
  8. {
  9. int v[1000],n,mx=-1000001,mn=1000001,i;
  10. fin>>n;
  11. for (i=0;i<n;i++)
  12. fin>>v[i];
  13. for (i=0;i<n;i++){
  14. if (v[i]>mx)
  15. mx=v[i];
  16. if (v[i]<mn)
  17. mn=v[i];
  18. }
  19. fout<<mn<<' '<<mx;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement