Wednesday, 24 July 2013

C-Program to SUM of Elements Stored in an Array

#include<stdio.h>
main ()
{
int sum=0,n,i,a[50];
printf("Enter the number of elements\t");
scanf("%d",&n);
printf("\nEnter the numbers\t ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
printf("\nSum of given Numbers is %d",sum);
}


sakoncepts.blogspot.com
output

No comments:

Post a Comment