Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- const int size = 5;
- int arr[size]{ 23,-11,9,-18, -25 };
- int min = arr[0];
- int max = arr[0];
- for (int i = 0; i < size; i++) {
- if (arr[i] < min) {
- min = arr[i];
- }
- if (arr[i] > max) {
- max = arr[i];
- }
- }
- cout << "max = " << max << endl;
- cout << "min = " << min << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment