write a program to find the sum of the array elements in c
language?
Answer Posted / asish manoj k
#include <conio.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int n,r=0,i,a[10],s=0;
printf("enter the size of the array");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the %d element",r);
scanf("%d",&a[i]);
r=r+1;
}
for(i=0;i<n;i++)
{
s=s+a[i];
}
printf("sum of the elements of the array is %d",s);
system("PAUSE");
return EXIT_SUCCESS;
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Differentiate abs() function from fabs() function.
Are pointers really faster than arrays?
Can a pointer be volatile in c?
what is the different bitween abap and abap-hr?
Can a variable be both const and volatile?
What is a program flowchart?
Can we declare function inside main?
What is the easiest sorting method to use?
Is c is a low level language?
Do you know what are bitwise shift operators in c programming?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Which is best linux os?
write a program to concatenation the string using switch case?
Why does the call char scanf work?
Where is c used?