OCJP

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();
}

Leave a Reply

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


× How can I help you?