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
No comments:
Post a Comment