Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int N;
- int tmp, max, min;
- cout << "Enter the amount of numbers(N) = ";
- cin >> N;
- cout << "Enter the numbers:" << endl;
- cin >> tmp;
- max = min = tmp;
- for (int i = 1; i < N; i++)
- {
- cin >> tmp;
- if (tmp > max)
- max = tmp;
- if (tmp < min)
- min = tmp;
- }
- cout << "Summary of max and min elements equals = " << min + max << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment