Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- int a=0, max=-1, min = 34257;
- cin >> a;
- int arr[a];
- for (int i=0; i<a; i++)
- {
- cin >> arr[i];
- if (arr[i]%2==0 && arr[i]>max)
- max = arr[i];
- if (arr[i]%2!=0 && arr[i]<min)
- min = arr[i];
- }
- if (min == 34257)
- cout << -1 << " " << max;
- else cout << min << " " << max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement