All major conceptual S2 C-Programs with Algorithms
#include <stdio.h>
void main(){
int i,n,sum=0,avrg=0,a[100];
printf("Enter the number of elements in the array:");
scanf("%d",&n);
printf("Enter the elements of the array:");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
// Adding the elements
for(i=0;i<n;i++){
sum+=a[i]; // sum = sum + a[i];
}
avrg = sum/n;
printf("%d is the sum of the array\n", sum);
printf("%d is the average of the array", avrg);
}