Advertisement
Guest User

Untitled

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