Showing posts with label SUM OF ARRAY ELEMENTS. Show all posts
Showing posts with label SUM OF ARRAY ELEMENTS. Show all posts

Monday, January 19, 2015

SUM OF ARRAY ELEMENTS

PROGRAM:

#include<stdio.h>

main()

{

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

printf("Enter total no. of Elements\n"); scanf("%d",&n);

                         printf("Enter Array elements one by one\n"); for(i=0;i<n;i++)
     
scanf("%d",&a[i]);
for(i=0;i<n;i++)

sum=sum+a[i];
printf("The Sum of Array Elements is %d\n",sum);

}

OUTPUT:

Enter total no. of Elements 8

Enter Array elements one by one 15 69 32 10 45 66 32 11





The Sum of Array Elements is 280