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
What is the difference between functions getch() and getche()?
What is the explanation for cyclic nature of data types in c?
Explain how do you use a pointer to a function?
What is the best style for code layout in c?
Why does everyone say not to use scanf? What should I use instead?
Which of these functions is safer to use : fgets(), gets()? Why?
What are the header files used in c language?
How can I avoid the abort, retry, fail messages?
Explain enumerated types in c language?
What is difference between union All statement and Union?
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
Difference between Shallow copy and Deep copy?
What is the meaning of c in c language?
Why is python slower than c?
What is the difference between the = symbol and == symbol?