Untitled

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

int main()
{
	int n, a, max = 0, min = a;
	cin >> n;
	while (n)
	{
		cin >> a;
		if (a > max) max = a;
		if (a < min) min = a;
		n--;
	}
	cout << max << endl << min << endl << endl;
	cout << max - min;
}
Leave a Comment