write a program to find the sum of the array elements in c
language?
Answer Posted / m.sushma
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],sum=0,n,i;
printf("Enter range");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("The sum of all the elements in the given array
is\n");
for(i=0;i<n;i++)
sum=sum+a[i];
printf("%d",sum);
getch();
}
Is This Answer Correct ? | 19 Yes | 15 No |
Post New Answer View All Answers
Why structure is used in c?
How is a macro different from a function?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
How is pointer initialized in c?
What is getch c?
Why static variable is used in c?
What are the differences between new and malloc in C?
What is the use of header?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
What is the purpose of the statement: strcat (S2, S1)?
What is the collection of communication lines and routers called?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
When is a “switch” statement preferable over an “if” statement?
Explain what are the standard predefined macros?
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode