write a program to find the sum of the array elements in c
language?
Answer Posted / aisha
#include<Stdio.h>
void main()
{
int sum=0,a[10],i,n;
printf("enter value of n");
scanf("%d",&n);
printf("enter array elements");
for(i=o;i<=n;;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
sum= sum+a[i];
}
printf("sum of all array elements = %d",sum);
}
| Is This Answer Correct ? | 11 Yes | 5 No |
Post New Answer View All Answers
Difference between malloc() and calloc() function?
Explain what are reserved words?
What is the usage of the pointer in c?
When should I declare a function?
Array is an lvalue or not?
How does free() know explain how much memory to release?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
What is the use of getch ()?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
write a program to generate address labels using structures?
write a c program for swapping two strings using pointer
What is a structure in c language. how to initialise a structure in c?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is the argument of a function in c?
How macro execution is faster than function ?