#include <stdio.h>
double Av(double *scores, size_t n, double * sum);
int main(void)
{
printf("Hello World!\n");
const size_t n = 50;
double a[n];
double sum = 0;
for(size_t i = 0; i< n; i++)
scanf("%lf", &a[i]);
printf("\nave = %lf ", Av(a, n, &sum));
printf("sum = %lf\n", sum);
return 0;
}
double Av(double *scores, size_t n, double *sum)
{
double ave = 0;
for(size_t i = 0; i < n; i++){
ave += scores[i];
*sum += scores[i];
}
ave = ave / (double)n;
return ave;
}
Comments
Leave a comment