Sum of Array Elements

Code

#include < stdio.h>
#include < conio.h>

int main(){

int a[10];
int i, N, sum=0;

printf("Input the number of elements to be stored in the array :");
scanf("%d",&N);

printf("Input elements of array :");

for ( i=0 ; i< N ; i++)
scanf("%d",&a[i]);

for ( i=0 ; i< N ; i++){
sum += a[i] ;

printf("Sum of all elements stored in the array is : %d\n\n", sum);
return 0;
}

Memory


Enter Values



Input Array Elements