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
Where we use clrscr in c?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
Explain how can you be sure that a program follows the ansi c standard?
Can a program have two main functions?
what are the advantages of a macro over a function?
Explain what are its uses in c programming?
What are the functions to open and close the file in c language?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What is the use of static variable in c?
write a program to rearrange the array such way that all even elements should come first and next come odd
Is there a way to compare two structure variables?
What is wrong with this statement? Myname = 'robin';
What are the general description for loop statement and available loop types in c?
What is a #include preprocessor?
What is structure packing in c?