Sum of Element
#include<stdio.h>
#include<conio.h>
void main()
{
int i, a[5];
int sum=0;
clrscr();
printf("enter the no :\n");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
printf("\n the sum is :%d",sum);
getch();
}
From Basic to the Best
#include<stdio.h>
#include<conio.h>
void main()
{
int i, a[5];
int sum=0;
clrscr();
printf("enter the no :\n");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
printf("\n the sum is :%d",sum);
getch();
}