#include <stdio.h> #include <stdlib.h>
int main() { int n, i, max, min, sum; int *arr; scanf("%d", &n); arr = (int *)calloc(n, sizeof(int)); for (i = 0; i < n; i++) { scanf("%d", arr + i); if (i == 0) max = min = sum = arr[i]; else { if (arr[i] > max) max = arr[i]; if (arr[i] < min) min = arr[i]; sum += arr[i]; } } printf("%d\n%d\n%d\n", max, min, sum); free(arr); return 0; }
|