Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
352 B
0
Indexable
Never
#include <iostream>
#include <math.h>
#include <string>

int main() {
    
    int N,max = -9999999,min = 9999999;


    std::cin >> N;
    int a;
    for (int i = 0; i < N; i++) {
        std::cin >> a;
        if (a > max) {
            max = a;
        }if (a < min) {
            min = a;
        }
    }std::cout << max - min;
}
Leave a Comment