write a program to find the sum of the array elements in c
language?
Answer Posted / heemashree
#include "stdio.h"
#include "conio.h"
#include "stdafx.h"
void main()
{
int a[10];
int i,sum=0,n;
printf("enter number of elements");
scanf("%d",&n);
printf("Enter the array elements\n");
for (i=0; i<n; i++)
scanf("%d",&a[i]);
// sum of array elements
for (i=0; i<n; i++)
{
sum=sum+a[i];
}
printf("Sum of array elements===%d",sum);
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Explain can the sizeof operator be used to tell the size of an array passed to a function?
What is a nested formula?
Should I learn c before c++?
What does & mean in scanf?
When can a far pointer be used?
What is use of pointer?
How do you print only part of a string?
How many bytes are occupied by near, far and huge pointers (dos)?
Write the syntax and purpose of a switch statement in C.
Why does everyone say not to use gets?
write a program to copy the string using switch case?
What is header file in c?
What is linear search?
What are the types of type qualifiers in c?
Whats s or c mean?