/**********************************************
Program to sum the elements of an array
**********************************************/
#include<stdio.h> // include stdio.h library
#define MAX 5
int main(void)
{
int arr[MAX];
int sum = 0; // accumulate sum in this variable
// read input
for(int i = 0; i < MAX; i++)
{
printf("Enter a[%d]: \n", i);
scanf("%d", &arr[i]);
}
// loop from index 0 to MAX
for(int i = 0; i < MAX; i++)
{
sum += arr[i]; // add the current element to sum
}
printf("\nSum = %d", sum);
return 0; // return 0 to operating system
}