Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int min = INT_MAX;
- int max = INT_MIN;
- for (int i = 0; i < n; i++)
- {
- int num;
- cin >> num;
- if (num > max)
- {
- int maxNum = num;
- max = maxNum;
- }
- if (num < min)
- {
- int minNum = num;
- min = minNum;
- }
- }
- cout << "Max number: " << max << "\n";
- cout << "Min number: " << min << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement