Write A Program For Find the sum of array Elements

#include<stdio.h>
# include<conio.h>
void main()
{
int i,n,a[50],sum=0;
clrscr();
printf(“Enter the total number of elements = “);
scanf(“%d”,&n);
printf(” Enter the value of all element : “);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
sum=sum+a[i];
}
printf(” Sum = %d”,sum);
getch();
}

Output:

Posted in: C

Leave a Reply

Your email address will not be published. Required fields are marked *