You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
335 B
27 lines
335 B
#include<bits/stdc++.h>
|
|
using namespace std;
|
|
int main() {
|
|
int i,n,max,min,s,sum=0;
|
|
scanf("%d",&n);
|
|
int a[n];
|
|
|
|
for(i=0; i<n; i++) {
|
|
scanf("%d",&a[i]);
|
|
sum+=a[i];
|
|
}
|
|
max=min=a[0];
|
|
for(i=1; i<n; i++) {
|
|
if(a[i]>=max) {
|
|
max=a[i];
|
|
}
|
|
if(a[i]<=min) {
|
|
min=a[i];
|
|
}
|
|
}
|
|
printf("%d\n%d\n%d\n",max,min,sum);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|