//Addition of array values.
#include<stdio.h>
#include<conio.h>
void main() {
int a[5];
int i,sum=0;
clrscr();
printf("Enter the 5 value of an array:\n");
for(i=0;i<5;i++)
{
scanf("\n%d",&a[i]);
}
printf("\nAddition of 5 values of array is:");
for(i=0;i<5;i++)
{
sum=sum+a[i];
}
printf("%d",sum);
getch();
}
Output:
Enter the 5 value of an array:1
2
3
4
5
Addition of 5 values of array is:15
No comments:
Post a Comment