Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int A[10], max, min;
- for (size_t i = 0; i < 10; i++) {
- cout << "A[" << i << "]: ";
- cin >> A[i];
- }
- max = min = A[0];
- for (size_t i = 0; i < 10; i++) {
- if (min > A[i])
- min = A[i];
- else if (max < A[i])
- max = A[i];
- cout << "A[" << i << "]: " << A[i] << endl;
- }
- cout << "Min element: " << min << " | Max Element: " << max << " | Difference between them: " << (max - min) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement