Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[10] = { 1,2,-1,6,4,5,3,9,0,1 }, n = 10, min, max;
  8. for (int i = 0; i < n; i++) {
  9. cout << a[i] << " ";
  10. }
  11.  
  12. min = max = a[0];
  13. for (int i = 1; i < n; i++) {
  14. if (a[i] < min) min = a[i];
  15. else if (a[i] > max) max = a[i];
  16. }
  17. cout << endl << min << ' ' << max;
  18. return 0;
  19.  
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement