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
If the size of int data type is two bytes, what is the range of signed int data type?
How do we print only part of a string in c?
Explain what is meant by high-order and low-order bytes?
Can a file other than a .h file be included with #include?
Where we use clrscr in c?
What is d'n in c?
When should you not use a type cast?
Explain about the functions strcat() and strcmp()?
What is size of union in c?
Define VARIABLE?
What is stack in c?
What is a structural principle?
What is main function in c?
what are the different storage classes in c?
Why shouldn’t I start variable names with underscores?