C and C++

sum and average of elements in the Array

#include<stdio.h>

#include<conio.h>

void main()

{

int a[20],i,sum=0;

float avg=0;

printf(“\n Enter the element:”);

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

{

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

}

printf(“\n The elements in the array are:”);

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

{

sum=sum+a[i];

}

printf(“\n The Sum of elements in the array is %d”,sum);

avg=sum/20;

printf(“\n The Average of elements in the array is %f”,avg);

getch();

}