#include<stdio.h>
int main()
{
int i,a[50],sum,n;
/* Read total array list elements */
printf("\n Enter Total Number of Elements in Array :");
scanf("%d",&n);
/* Reading all the values */
printf("\n Enter the Array values :");
for(i=0; i < n; i++)
scanf("%d",&a[i]);
/* Do Sum of all the Elements */
sum=0;
for(i=0; i < n; i++)
sum=sum+a[i];
/* Print all the array values */
for(i=0; i < n; i++)
printf("\n a[%d]=%d",i,a[i]);
/* printing of total */
printf("\n Total Sum of the Array Values =%d",sum);
return 0;
}
OUTPUT:
Enter Total Number of Elements in Array :5 Enter the Array values :10 20 30 40 50 a[0]=10 a[1]=20 a[2]=30 a[3]=40 a[4]=50 Total Sum of the Array Values =150