#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;
}
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;
}
this post was really helpful for me thankyou so much for posting that. I hope you will further post such type of important programs so that I can understand it well. Thankyou!\
ReplyDeletehelpful content.
ReplyDelete