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
write a program to concatenation the string using switch case?
What 'lex' does?
write a c program for swapping two strings using pointer
what is a function method?give example?
What are the main characteristics of c language describe the structure of ac program?
What is string constants?
How macro execution is faster than function ?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What will be your course of action for a push operation?
What does sizeof int return?
Which is best linux os?
Is null valid for pointers to functions?
What is header file definition?
What is wrong with this program statement? void = 10;
What is the difference between a string and an array?