EmbLogic's Blog

Finding Average of an array

#include<stdio.h>
int main()
{
int  a[100],n,i;
float Avg=0,sum=0;
printf(“enter Numbre of  array :\t”);
scanf(“%d”,&n);
printf(“Enter the element of array\n”);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
sum=sum+a[i];
}
Avg=sum/n;
printf(“Avg = %f\n”,Avg);
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>