Computer Science, asked by gsalu582, 1 year ago

write a function which accepts an array of size n containing integer value and returns average all value call the function from main program​

Answers

Answered by Anonymous
3

Answer -

#include<stdio.h>

int avg(int [],int);

main()

{

int a[100], n,i,avrg;

printf("\nEnter number of terms=");

scanf("%d",&n);

for(i=0;i<n;i++)

{

scanf("%d",&a[i]);

}

avrg=avg(a,n);

printf("\nThe average=%d",avrg);

}

int avg(int a[],int n)

{

int i,s=0;

for(i=0;i<n;i++)

{

s=s+a[i];

}

return s/n;

}

→ Hope it will help you ❣️❣️

→ Please mark as Breinliest ❤️❤️

Similar questions