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 between #include<...> and #include '...'
How can I implement a delay, or time a users response, with sub-second resolution?
What is the difference between array and pointer in c?
Explain what is the benefit of using an enum rather than a #define constant?
How are pointers declared in c?
What is the process to generate random numbers in c programming language?
Do you know the use of fflush() function?
Describe wild pointers in c?
What is atoi and atof in c?
What is the use of f in c?
Explain the use of function toupper() with and example code?
What are the types of data structures in c?
Why clrscr is used in c?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
Is linux written in c?