#include <stdio.h>
int a[] = { 17, 23, 4, 9, 19, 33, 8, 45 };
int sum(int v[], int n) {
int s = 0;
for (int i = 0; i < n; i++) {
s = s + v[i];
}
return s;
}
double average(int v[], int n) {
return (double)sum( a, n ) / n;
}
int main() {
printf("somma = %d\nmedia = %lf\n", sum( a , 7 ), average( a, 7 ));
}
To embed this project on your website, copy the following code and paste it into your website's HTML: