Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
344 B
1
Indexable
Never
using namespace std;
#include <iostream>

int main()
{
    int n;
    int t;
    int max = 0;
    int min =2147483647;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> t;
        if (t < min) {
            min = t;
        }
        if (t > max){
            max = t;
        }
    }
    cout << max - min;
}
Leave a Comment