write a program to find the sum of the array elements in c
language?
Answer Posted / lalit suthar, nilod
// write a program to find the sum of the array elements in
c language?
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],i,sum=0;
clrscr();
printf("Enter the array elements\n");
for (i=0; i<5; i++)
scanf("%d",&a[i]);
// sum of array elements
for (i=0; i<5; i++)
{
sum=sum+a[i];
}
printf("Sum of array elements===%d",sum);
getch();
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is character constants?
write a c program to calculate sum of digits till it reduces to a single digit using recursion
What is the difference between new and malloc functions?
what is the basis for selection of arrays or pointers as data structure in a program
Explain logical errors? Compare with syntax errors.
What is non linear data structure in c?
Explain 'far' and 'near' pointers in c.
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What does %d do?
Whats s or c mean?
What does %p mean?
How can I call fortran?
What is struct node in c?
What is the mean of function?
Are there namespaces in c?